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.
Why is SELECT * considered a performance anti-pattern for production dashboards, ETL jobs, and large queries? Rewrite a wide, unfiltered SELECT * query to be production-safe and explain each dimension of the improvement (I/O, network transfer, index-only-scan eligibility).
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.
You have several tables of very different sizes and selectivities to join for a single query. Walk through how join order and predicate placement interact: which filters should run first, how the optimizer decides whether to trust your ordering or reorder itself, and what you would do if the plan it chooses is measurably worse than the order you expect.
What is a covering index, and how does it let the planner satisfy a query using only the index (an index-only scan) instead of also visiting the table? Given a concrete query that selects a small number of columns with a selective WHERE clause, describe the index you would create and why.
Tell me about a time you diagnosed and fixed a real production database performance problem. Using the STAR format, describe how you noticed and measured it, what you changed, and the concrete impact once it shipped.
Unlock Full Question Bank
Get access to all 45 Query Optimization and Execution Plans interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.