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.

HardTechnical
67 practiced

You inherit a slow, high-value report (or dashboard) built on a table that has grown to hundreds of millions or billions of rows, and you have a few months, not a rewrite budget, to fix it. Lay out a prioritized plan spanning quick wins, medium-term schema/index changes, and longer-term architectural options, and how you would sequence them.

MediumTechnical
75 practiced

A query filters on a column that has an index, but wrapping that column in a function or an implicit type conversion is silently preventing the index from being used. Walk through how you would confirm that is what's happening, and the different ways you could restore index usage (query-side and, where appropriate, schema-side).

EasyTechnical
87 practiced

You need to explain to a non-technical stakeholder why a proposed index (or a materialized/pre-aggregated table) is worth the write-latency or storage cost it introduces. Lay out the talking points you would use: the benefit in terms they care about, the concrete cost, and how you would validate afterward that it actually helped.

HardSystem Design
84 practiced

Design a lightweight monitoring approach to catch query plan regressions before they page anyone: what would you compare between two runs of the same query (or two versions of a plan), what thresholds would make something worth investigating, and how would you keep the noise level low enough that engineers trust the alerts?

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 45 Query Optimization and Execution Plans interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.