Databases interview questions
100 System Design practice questions. Read what a strong answer covers, then practise it out loud against the clock.
Practise Databases questionsBeginner
- A query is slow on a large table
- ACID properties
- Adding product search
- Backups vs replication
- BASE in NoSQL systems
- Choosing primary keys
- Database for a blog platform
- Database for an e-commerce order system
- Database for user sessions
- Database vs cache roles
- Designing file uploads
- Leader-follower replication
- Managed vs self-hosted databases
- Normalisation vs denormalisation
- Renaming a column without downtime
- Schema changes on a live database
- Someone deleted a table
- SQL vs NoSQL in system design
- Storing chat messages
- Storing server metrics
- The primary database dies
- Time-series databases
- Too many indexes
- Types of NoSQL databases
- Vertical vs horizontal partitioning
- What a database index is
- What database replication is
- What sharding is
- When to use a document database
- When to use a graph database
- When to use a key-value store
- When to use a wide-column store
- Where to store images and videos
- Why use a search engine alongside the database
Intermediate
- B-trees vs LSM trees
- Bloom filters in databases
- Change data capture
- Choosing a shard key
- Choosing databases for a food delivery app
- Consistent hashing in databases
- Database CPU fine but queries queue
- Defining backup requirements
- Designing a DynamoDB table
- Distributed SQL databases
- Finding nearby restaurants
- Generating IDs across shards
- Leaderboard query is too slow
- Leaderless replication and quorums
- Listing millions of files is slow
- Materialised views
- Migrating from MySQL to a new database
- Multi-leader replication
- One shard is overloaded
- Optimistic vs pessimistic locking
- Query across all shards
- Range vs hash sharding
- Row stores vs column stores
- Search index out of sync
- Secondary indexes in sharded databases
- Sharding a multi-tenant SaaS database
- Sharding a users table
- Synchronous vs asynchronous replication
- Table grows forever
- Transaction isolation levels
- Two users edit the same document
- User saves and sees old data
- Write-ahead log
Experienced
- Bounded staleness reads
- Cache and database disagree
- Cassandra partitions grow too big
- Consensus in databases
- CRDTs for conflict-free replication
- Database costs are huge for old data
- Defending Postgres at scale
- DynamoDB throttling on one key
- Event sourcing
- Flash sale on one product row
- Hot, warm and cold data tiers
- Migrating from single DB to sharded DB
- Multi-region database design
- MVCC
- One bad query takes down the database
- Online resharding
- Order spans three services' databases
- Publishing events reliably after a database write
- Query plan suddenly changes
- Ransomware encrypts your databases
- Real-time analytics on operational data
- Replicas cause a double booking bug
- Schema evolution in a NoSQL store
- Should a banking ledger use event sourcing?
- Sloppy quorums and hinted handoff
- Social graph at scale
- Split-brain in database failover
- Time and ordering in distributed databases
- Two primaries after a network glitch
- Two-phase commit
- Unique usernames across shards
- Write amplification
- Write skew in on-call scheduling