Query Optimization and Execution Plans Questions

Making queries fast: reading and interpreting execution/explain plans, identifying full scans, spotting SQL anti-patterns, and rewriting queries for better performance. Covers how the planner chooses join order and access methods, and how statistics drive those choices. A core skill for anyone responsible for query performance in production.

MediumTechnical
88 practiced

How does the order of columns in a multi-column (composite) index affect its usefulness? Given a query with an equality predicate, a range predicate, and an ORDER BY, work through which column order lets the index serve the filter and avoid a separate sort, and which orderings would not.

MediumTechnical
137 practiced

Describe a repeatable methodology for benchmarking a proposed query rewrite (or an index, or a join change) against the current query: how you would capture a fair baseline, control for caching and concurrency, choose metrics, and decide whether an observed improvement is real rather than noise.

MediumTechnical
73 practiced

What is predicate pushdown, and why does it matter for query performance, especially against columnar storage formats (Parquet, ORC) or a foreign data wrapper? Give a concrete example where moving a filter earlier in a query (for example into a subquery or a join) lets the engine reduce how much data it reads, and describe how you would verify from the plan that pushdown is actually happening rather than assumed.

MediumTechnical
137 practiced

A query sorts (or filters) on a computed expression rather than a bare column, and the plan shows a sequential scan plus an explicit sort even though a similar bare-column query would use an index. Propose an index-based fix, and note what limits it (for example, the expression in the query has to match the indexed expression exactly).

MediumTechnical
75 practiced

You are looking at a plan that uses index scans, but the actual execution time is high because the index lookups are producing a lot of random I/O. Explain the conditions under which a single sequential scan can genuinely be faster than many small indexed lookups, and how you would decide which is happening for a specific slow query.

Unlock Full Question Bank

Get access to all Query Optimization and Execution Plans interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.