All jobs / Database administrator / Performance
Database administrator interview question · 3–5 years
The largest tenant’s dashboard times out every morning while every other tenant loads instantly.
The same parameterised query is fast for most customers and terribly slow for one large customer. What is going on?
The strongest answer
The cached plan was built for a typical parameter value and is wrong for the skewed one — parameter sniffing; I can recompile that query, optimise for a representative value, or split the code path
Why it works
Exactly — skew plus plan reuse; fix it at the query, not the whole cache.
What a good answer covers
- Skewed data, reused plan.
- Compare the two plans.
- Fix the one query.
- Do not flush the world.
Answers that fall short
- Close, but not the strongest: That customer has more data, so it will always be slower
More data explains a little slower, not a plan that is wrong for the shape. - Weak: The index is fragmented for that customer’s rows
Fragmentation is not per customer; a plan chosen for the wrong cardinality is. - Red flag: Clear the whole plan cache whenever it happens
Flushing everything punishes every other query and the problem returns.
Who gets asked this
More Performance questions
- The plan cache is full of thousands of near-identical statements that differ only by literal values. Impact…
- A nightly job updating a few million rows locks the entire table and blocks the application. Why, and what do…
- One row holding a global counter is updated by every request and has become the bottleneck. Options?
- A table is partitioned by month but queries still scan every partition. Why?
- The server is busy and nobody can say why. How do you use wait statistics to answer that?
- In plain words, how does an index make a query faster?
- A developer suggests indexing every column “just in case”. Your response?
- An application opens a new database connection for every web request. Concern?