Database scenario interview questions for DevOps and SRE
Database questions for infrastructure roles are about keeping data safe while things change: a migration on a busy table, a failover that loses writes, backups nobody has restored. Most of them come down to what is reversible and what is not.
Each question below is the exact prompt from a DevOps Ledger challenge. Decide what you would do, then open the challenge to defend it.
10 scenarios: 2 beginner, 4 intermediate, 4 advanced. Answer keys reviewed by Branko Petric.
What interviewers probe
- Proving backups by restoring them
- Expand and contract migrations
- Replication lag and what an async failover can lose
The questions
- 01beginner8 min
Nightly Backups Run. Are You Actually Covered?
Your team set up automated nightly database backups months ago. A teammate says we are fully covered if anything goes wrong. Do you agree, and what would you check?
Practice this scenario - 02intermediate14 min
Add a NOT NULL Column to a 50M-Row Prod Table
You need to add a NOT NULL column with a default to a 50 million row table in production. A teammate wants to just run the ALTER TABLE during business hours. How do you do this without taking the app down?
Practice this scenario - 03advanced15 min
Your Primary Region Is Down. Fail Over Now?
Your primary cloud region is having a major outage and your app is degraded. You have a standby in another region with an async database replica. A teammate says just flip DNS to the standby right now. Do you fail over, and how?
Practice this scenario - 04intermediate12 min
Every Deploy Hammers the Database for 10 Minutes. Bigger DB?
Every deploy flushes your Redis cache, and for the next 10 minutes the database runs at 95% CPU serving a flood of identical queries while the cache refills. Users see timeouts. A teammate proposes doubling the database instance size so it can absorb the refill. Do you upsize the database, or fix something else? Defend your call.
Practice this scenario - 05advanced14 min
Failover Lost 5 Minutes of Writes. Promise Zero Data Loss?
Your primary database died and you failed over to an async replica. Five minutes of committed writes - orders customers got confirmations for - are gone. Leadership says: guarantee this never happens again, with zero data loss and zero performance impact. What do you tell them, and what do you actually build?
Practice this scenario - 06advanced13 min
The Nightly Report Is Slow. Just Run It in One Big Transaction?
A nightly analytics job holds one long-running Postgres transaction open for hours, and now writes are bloating and autovacuum can't keep up. A teammate says just give the DB more resources and raise timeouts so the long transaction can finish. What do you do, and why?
Practice this scenario - 07intermediate12 min
Lambda Is Exhausting Your RDS Connections. Raise the Limit?
During traffic spikes your Lambda functions start failing with too many connections errors against RDS. A teammate says just raise max_connections on the database. Do you agree, and what do you do instead?
Practice this scenario - 08advanced15 min
DynamoDB Is Throttling but Capacity Looks Idle. Crank It Up?
DynamoDB is returning throttling errors on certain requests, yet the table-level consumed capacity is far below what is provisioned. A teammate says just raise the capacity or switch to on-demand. What is really happening, and what do you do?
Practice this scenario - 09beginner9 min
A Contractor Needs DB Access for a Week. Open the Port?
An external contractor needs read access to the production database for one week of analysis work. A teammate proposes opening the database port (5432) to the internet in the firewall and giving the contractor a strong password. What do you do, and why?
Practice this scenario - 10intermediate12 min
Terraform Doesn't Know the Hand-Made DB. Let It Build a New One?
You're bringing a manually-created prod RDS instance under Terraform, and because it's not in state, plan shows Terraform wanting to create a new instance. A teammate says just apply it, Terraform will make a matching one, we'll point the app at it and be consistent. What do you do, and why?
Practice this scenario
Worked answers
- Scenario Based DevOps Interview Questions, With Worked Answers
Scenario based DevOps interview questions for Linux, Docker, CI/CD, Git and AWS, with first commands, the interviewer's pushback, and weak vs strong answers.
Practice defending your decisions
DevOps Ledger is a scenario-based DevOps and SRE interview practice platform: you pick a real production incident, defend your decision in a chat against a senior-engineer AI that pushes back, and get scored against an answer key written before you started.
A general chatbot makes up an answer on the spot. DevOps Ledger grades you against an answer key written before you started.
One payment. 12 months of access. No subscription, nothing renews.
Get full access - $19