Database Monitoring, Troubleshooting, and Diagnostics Questions

Observing and fixing databases in production: health checks, metrics and alerting, and diagnosing common failures like slow queries, lock contention, replication lag, resource exhaustion, and data-integrity incidents such as duplicate keys or lost updates after a crash or migration. Covers a systematic troubleshooting method under incident pressure. Tests operational instincts distinct from design knowledge.

EasyTechnical
40 practiced

Write a PostgreSQL SQL query that lists the top 5 queries by average duration in the last 24 hours using pg_stat_statements. Include columns: query, calls, total_time, mean_time, and max_time. Provide the SQL and a short explanation of how you'd interpret the results to prioritize optimization work.

EasyTechnical
62 practiced

Define database SLOs and error budgets the way an SRE would use them day to day. Give a couple of concrete examples of what a DB-layer SLO might look like, then explain how alert thresholds and paging policy should map to SLO burn versus an immediate page.

MediumTechnical
30 practiced

You observe growing lock contention and many blocked transactions causing user-visible slowdowns. Walk through diagnostic steps to identify blocking chains and the root blocking session in PostgreSQL or MySQL. Include example SQL or commands to find blockers, how to interpret the lock types you find, and safe remediation steps to resolve the blocking without violating data consistency.

MediumTechnical
35 practiced

An application started throwing intermittent 'duplicate key value violates unique constraint' errors after a migration. Outline how you'd determine whether this is due to an application-level race condition, a migration script bug, or genuinely inconsistent data. Include SQL queries to locate the duplicates, checks you'd run on the migration script, and steps to mitigate impact in production while you investigate.

MediumSystem Design
30 practiced

Design a runbook for responding to a primary database failure aimed at minimizing downtime. Include detection thresholds, automated checks, commands for promoting a healthy replica, verification steps after promotion (for example, smoke writes and reads), rollback triggers if problems are detected, and how you'd communicate status to stakeholders.

Unlock Full Question Bank

Get access to all 38 Database Monitoring, Troubleshooting, and Diagnostics interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.