THN Interview Prep

Database query path

Core details

Repeatable workflow

  1. Find query text — slow query log, pg_stat_statements (Postgres) or vendor equivalent.
  2. EXPLAIN (ANALYZE)estimated vs actual rows; huge gap ⇒ stale statistics or bad parameter sniffing class issues.
  3. Access path — seq scan vs index vs bitmap; why did the optimizer choose it?
  4. Locks / waitspg_locks, wait events—low CPU + high latency often waiting, not “slow query.”
  5. Replica vs primaryread-your-writes and lag; intermittent “bugs” may be stale replica.

Write-path awareness

Indexes speed reads and cost writes. Hot updates on wide indexes → bloat and contention.

Understanding

“Add an index” without plan proof is index theater. Often the fix is narrower SELECT, batching, keyset pagination, or fresh stats—not more B-trees.

Senior understanding

SymptomFirst split
High latency, low DB CPUlocks, disk, replication lag, pool wait
Plan flips across daysstats, skew, prepared statement plans

Deep relational + caching narrative: /databases and Indexing & query tuning.

Diagram

Loading diagram…

See also

Last updated on

Spotted something unclear or wrong on this page?

On this page