All jobs / Database administrator / Performance
Database administrator interview question · 1–3 years
The checkout page has been timing out for five minutes and the on-call is asking for help.
Dozens of sessions are waiting and the app has slowed to a crawl. How do you find the culprit?
The strongest answer
Query the lock and session views to find the head of the blocking chain, see what that session is doing and who owns it, then decide whether to wait, contact them or kill it
Why it works
Exactly — find the root blocker, understand it, then act with a decision rather than a reflex.
What a good answer covers
- Find the head of the chain.
- Understand before you kill.
- Waiters are victims.
- Restarts are not lock management.
Answers that fall short
- Close, but not the strongest: Restart the database service so every lock is released
A restart kills every transaction and the blocker will likely return. - Weak: Kill the sessions that have been waiting the longest so the queue clears
The waiters are victims; killing them does nothing to the blocker. - Red flag: Increase the lock timeout so the waiters stop failing
Longer timeouts mean longer queues.
Who gets asked this
More Performance questions
- The application logs show deadlocks a few times a day. What do you do?
- Several sessions sit “idle in transaction” for hours. Why does that matter and what do you do?
- A query that ran in milliseconds now takes minutes, right after a large data load. First suspect?
- The database shows thousands of identical tiny queries per page load. What is happening and what do you…
- What is a covering index and when is it worth it?
- Hundreds of application pods each keep a pool of twenty connections. The database is out of connections. Fix?
- The same parameterised query is fast for most customers and terribly slow for one large customer. What is…
- The plan cache is full of thousands of near-identical statements that differ only by literal values. Impact…