Postgresql easy
Which SQL command is used to retrieve the execution plan chosen by the PostgreSQL query optimizer for a specific statement?
- A ANALYZE: Generates fresh statistics about table data distributions for the planner.
- B PREPARE: Pre-compiles the query string to reduce parsing overhead for future calls.
- C EXPLAIN: Displays the sequence of operations (scans, joins) intended for the query.
- D QUERYINFO: Provides a summary of the network latency for the last executed command.
Answer: C. EXPLAIN: Displays the sequence of operations (scans, joins) intended for the query.
`EXPLAIN` allows developers to see if the database is using an Index Scan or falling back to a slow Sequential Scan. It is the primary tool for query optimization and performance debugging.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- In a PostgreSQL environment, what functional characteristic distinguishes a `MATERIALIZED VIEW` from a standard `VIEW`?
- Which standard PostgreSQL utility is designed to extract a single database into a script or archive file for backup purposes?
- Why would PostgreSQL reject a `DELETE` operation on a record despite the user having full administrative privileges?
- The 'Heap Only Tuples' (HOT) optimization improves UPDATE performance. Which specific set of conditions must be met for a HOT update to occur?
- Which native command-line utility is used to execute SQL queries and manage PostgreSQL databases from a terminal session?
- What is the specific purpose of 'Freezing' a row (modifying its `xmin` status) during a major VACUUM operation?