Skip to content
Preptima

Query Optimisation interview questions

Reading execution plans, statistics and cardinality estimation, and diagnosing real regressions.

3 questions in Databases & SQL.

medium2

mediumConcept

Before you tune anything, how do you decide which queries are worth your time?

Rank by the total time a statement shape consumes across a measured window rather than by the slowest single execution, then check what that time was spent waiting on before touching the SQL. The cheap statement running ten thousand times a minute usually outranks the ten-second report.

4 minmid, senior, staff
mediumConceptScenario

Walk me through how you read a PostgreSQL execution plan.

Read the plan tree innermost-node-first, remember that EXPLAIN only estimates while EXPLAIN ANALYZE executes, multiply each node's actual rows by its loops, and treat a large gap between estimated and actual rows as the primary finding.

5 minmid, senior, staff

hard1