Boarding pass · SQL Advanced
SQL · Advanced interview
An AI mock interview for senior engineers working with SQL databases. Reason about query optimization and execution plans, concurrency and locking, scaling strategies, and data modeling trade-offs.
- Voice interview
- Live feedback
- Browser-only
- No installation required
Your report · sample
AI Readiness Score
Finish the mock and get this report — scored on content and English, with concrete tips and a model answer for every question, plus a study plan.
Your flight path
Five steps to interview-ready.
From a quick warm-up to a personalised study plan — here's the whole loop, and what you get at each gate.
Step 01
Preparation
Skim the topics and warm up — you're briefed before takeoff.
Step 02
AI Interview
A realistic AI interviewer asks tailored questions — answer by voice or text.
Step 03
Instant Score
Finish and get a 0–100 readiness score across content and English.
Step 04
AI Feedback
Concrete tips and a rewritten model answer for every response.
Step 05
Study Plan
A personalised plan targets your weakest areas — so the next run scores higher.
Preview the AI demo
See one answer scored, end to end.
The whole loop on sample data — question, your answer, instant feedback and a study plan. Hover to pause.
Interviewer · Question 1
“Tell me about yourself.”
Who it's for
- Senior backend and data engineers
- Engineers who tune and scale databases
- Anyone targeting senior data-platform roles
- Devs who own schema and query performance
What you'll practice
- Reading execution plans and tuning queries
- Locking, MVCC and deadlocks
- Partitioning, replication and sharding
- Normalization vs denormalization at scale
Topics covered
What this level expects.
Query optimization
- Execution plans
- Slow-query causes
- Covering indexes
Concurrency
- Locking & MVCC
- Deadlocks
- Isolation in practice
Scaling
- Partitioning
- Replicas & sharding
- N+1 & pooling
Modeling
- Normalization trade-offs
- Large tables
- OLTP vs OLAP
Practice questions
12 questions, with model answers.
Read them, then run the live mock to answer out loud and get scored. Tap any question to reveal a model answer.
01How do you read an execution plan and find the bottleneck?Query optimization
EXPLAIN (ANALYZE) shows how the planner executes the query — the join order, access methods (sequential scan vs index scan), and estimated vs actual rows and time per node. You look for full scans on big tables, nested loops over large row counts, big mismatches between estimated and actual rows (stale statistics), and expensive sorts. The bottleneck is usually the node with the most time or a row-estimate that's wildly off.
02What are the common causes of slow queries and how do you fix them?Query optimization
Missing or unusable indexes, non-sargable predicates (functions on columns), bad join order from stale statistics, returning or scanning too many rows, N+1 query patterns, and large sorts/hashes spilling to disk. Fixes: add the right index (sometimes composite or covering), rewrite predicates to use indexes, update statistics, select only needed columns, add pagination, and batch or join instead of looping. Always verify with the plan, not intuition.
03What is a covering index / index-only scan?Query optimization
A covering index contains all the columns a query needs (in the key or as included columns), so the database can answer entirely from the index without touching the table heap — an index-only scan. It eliminates the extra random I/O of fetching rows, which can dramatically speed read-heavy queries. The trade-off is a larger index and more write overhead.
04What is MVCC and how does it relate to locking?Concurrency
Multi-Version Concurrency Control keeps multiple versions of a row so readers see a consistent snapshot without blocking writers and vice versa — readers don't take locks for reads. Writes still take row locks to prevent conflicting updates, and the engine decides visibility by transaction timestamps. MVCC (used by PostgreSQL, InnoDB, Oracle) is why 'readers don't block writers' and reduces lock contention compared to pure locking.
05How do deadlocks happen and how do you avoid them?Concurrency
A deadlock occurs when two transactions each hold a lock the other needs, forming a cycle, so neither can proceed; the database detects this and aborts one. You avoid them by acquiring locks in a consistent order across the app, keeping transactions short, touching rows in a deterministic sequence, using lower isolation where safe, and adding retry logic since the loser's transaction is rolled back. Consistent lock ordering is the biggest lever.
06How do you choose an isolation level in practice?Concurrency
Default to the database's sensible default (often READ COMMITTED) and raise it only where a specific anomaly would cause a correctness bug. Use REPEATABLE READ / SERIALIZABLE for operations that read-then-write based on what they read (to avoid lost updates and phantoms), accepting more blocking or serialization-failure retries. Often it's cleaner to use explicit row locks (SELECT ... FOR UPDATE) or optimistic concurrency than to globally raise isolation.
07What is partitioning and when do you use it?Scaling
Partitioning splits one large table into smaller physical pieces by a key — range (e.g. by date), list, or hash — while it still appears as one table. It speeds queries that can prune to relevant partitions, makes bulk deletes (drop an old partition) cheap, and eases maintenance. You use it for very large tables, especially time-series data, where most queries target a slice.
08How do you scale a relational database for reads and writes?Scaling
Reads: add read replicas and route read traffic to them (accepting replication lag), plus caching. Writes: vertical scaling first, then sharding the data across nodes by a shard key when a single primary can't keep up — at the cost of cross-shard queries and transactions becoming hard. You also tune indexes, batch writes, and offload analytics to a separate warehouse. Sharding is a last resort because of its complexity.
09What is the N+1 query problem and how do you fix it?Scaling
N+1 is when you run one query to fetch a list, then one more query per item to fetch related data — 1 + N round trips that crush performance at scale, common with naive ORM lazy loading. Fixes: fetch the related data in a single join or a batched IN query (eager loading / dataloader pattern), so you do a constant number of queries. Connection pooling also helps by reusing connections instead of opening one per query.
10When do you denormalize, and what do you give up?Modeling
You denormalize — duplicating or precomputing data — when read performance and query simplicity matter more than write simplicity, e.g. storing a cached count or embedding frequently-joined fields to avoid expensive joins at scale. What you give up is the single-source-of-truth guarantee: you now must keep the duplicated data in sync on every write, risking inconsistency. It's a deliberate trade of write complexity for read speed.
11How do you handle a table that has grown too large?Modeling
Options that stack: ensure proper indexing and prune unused indexes, partition by time or key, archive or roll off old rows to cold storage, and move heavy read/analytic load to replicas or a warehouse. For writes, batch and consider sharding. The right move depends on access patterns — often partitioning plus archiving handles time-series growth without sharding.
12What's the difference between OLTP and OLAP, and when do you use each?Modeling
OLTP (transactional) systems handle many small, concurrent read/write transactions with low latency — your normalized application database. OLAP (analytical) systems run large aggregating queries over historical data, typically denormalized and stored columnar in a data warehouse. You keep them separate because their workloads conflict: you ETL/stream from OLTP into OLAP rather than running heavy analytics on the production database.
Preparation tips
Walk in ready.
- Be able to spot a seq scan / nested-loop blowup in a plan
- Explain a covering / index-only scan
- Know how deadlocks form and how to avoid them
- Have a concrete partitioning strategy ready
Ready for the real thing?
Run a 6-question SQL mock interview, answer out loud, and get a readiness score with tips and model answers.
More advanced interviews