Skip to content
tezvyn:

Top 30 Intermediate Databases & Architecture Interview Questions and Answers

30 intermediate multiple-choice Databases & Architecture interview questions, past the definitions: how the pieces fit together, what breaks in practice, and the trade-off behind a choice. They come from 30 bites in the Databases & Architecture library, the middle slice of the 134 Databases & Architecture interview questions in the library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.

SQL, NoSQL, system design, microservices, APIs

30 questions. Pick an answer, or open “Show the answer” to read it.

Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.

  1. Question 1 of 30

    When is it appropriate to intentionally violate 3NF by duplicating a customer name in an orders table?

    Show the answer

    Answer: c · When read latency is critical and avoiding joins outweighs update anomaly risks

    Intentionally violating 3NF trades update anomaly risk for faster reads by eliminating joins, which is appropriate in read-heavy workloads. The most tempting distractor confuses the goal of normalization—preventing transitive dependencies—with a reason to denormalize.

    Read the full bite: Describe 1NF, 2NF, 3NF, normalization's purpose, and its performance trade-off.

  2. Question 2 of 30

    Which statement best captures the mechanical cost of maintaining multiple indexes on a write-heavy table?

    Show the answer

    Answer: c · Every table write typically triggers random I/O to update each index's B-Tree, plus node splits and log overhead

    The card explains that every write likely updates every index, causing extra random I/O, node splits, and WAL overhead. Option B reflects the common misconception that binary search trees are the classic disk structure, while D confuses hash indexes with the standard B-Tree approach.

    Read the full bite: Explain database indexes, the classic data structure, and write-heavy trade-offs

  3. Question 3 of 30

    When the Orders table may contain NULL user_ids, which statement correctly explains the safest way to find users who never placed an order?

    Show the answer

    Answer: b · NOT EXISTS is preferred because it is immune to NULLs in the subquery and avoids duplicate rows.

    NOT EXISTS handles NULL values safely and stops at the first match per user, avoiding duplicate rows. Option D is tempting because LEFT JOIN is a common pattern, but it can inflate results when a user has multiple orders unless you add DISTINCT or GROUP BY.

    Read the full bite: Find users who never placed an order and explain JOIN choice

  4. Question 4 of 30

    When writing a query that groups by department and filters on COUNT(*) > 10, why must the predicate be in HAVING rather than WHERE?

    Show the answer

    Answer: b · WHERE is evaluated before GROUP BY, so the aggregate count does not yet exist

    WHERE filters individual rows before grouping and aggregation occur, so aggregate values like COUNT(*) have not been computed yet and do not exist at that stage. Option D is wrong because repeating the aggregate expression in WHERE does not help; the aggregate still does not exist when WHERE is evaluated.

    Read the full bite: What is the difference between WHERE and HAVING in SQL?

  5. Question 5 of 30

    A category tree is read constantly to render menus but almost never restructured. Which model best fits, and why?

    Show the answer

    Answer: a · Nested set, because subtree reads are a single range query

    Nested set encodes descendants as a left/right range, so a whole subtree is one indexed query, ideal for read-heavy trees. Its weakness is expensive writes, which barely matters here since the tree is almost never restructured.

    Read the full bite: Adjacency List versus Nested Set for hierarchies

  6. Question 6 of 30

    A table is in 3NF but not BCNF because of a dependency Teacher to Subject where Teacher is not a superkey. What makes this still acceptable for 3NF?

    Show the answer

    Answer: d · Subject is a prime attribute, part of a candidate key

    3NF permits a non-superkey determinant when the dependent attribute is prime, so Subject being part of a candidate key keeps it in 3NF. BCNF has no such exception, which is exactly why the table violates BCNF.

    Read the full bite: 3NF versus BCNF and the overlapping-key gap

  7. Question 7 of 30

    Why does MVCC let a long-running read query avoid blocking concurrent writers?

    Show the answer

    Answer: b · Writers create new row versions while the reader keeps seeing its consistent snapshot

    Writers produce new versions rather than overwriting, so the reader continues consulting the versions visible at its snapshot without taking a lock. There is no table lock or write downgrade involved in MVCC reads.

    Read the full bite: How MVCC enables non-blocking reads

  8. Question 8 of 30

    Under Two-Phase Locking, what action is forbidden once a transaction has released its first lock?

    Show the answer

    Answer: a · Acquiring any new lock

    After the first release the transaction is in the shrinking phase and may only release, never acquire, which is what guarantees a conflict-serializable schedule. Continuing to release locks and committing are both allowed in the shrinking phase.

    Read the full bite: Two-Phase Locking and serializability

  9. Question 9 of 30

    A developer sees a high cost number in EXPLAIN output and concludes the query will take that many milliseconds. What is wrong with this reasoning?

    Show the answer

    Answer: c · Cost is an abstract optimizer unit, not a time measurement; only EXPLAIN ANALYZE gives real timings

    Cost is a unitless estimate the optimizer uses to compare plans, not wall-clock time. Actual durations come from EXPLAIN ANALYZE; the other options invent fixed conversions or scopes that do not exist.

    Read the full bite: What is a query execution plan?

  10. Question 10 of 30

    On a high-throughput insert table, which operation is most directly penalized by adding several indexes, and why?

    Show the answer

    Answer: c · Writes, because every INSERT must also add entries to each index

    Each index is a structure the engine must keep in sync, so every insert pays to update all of them, throttling write throughput. Reads generally benefit from indexes, and the lazy-maintenance claim is false for transactional engines.

    Read the full bite: Trade-offs of adding indexes to a table

  11. Question 11 of 30

    A query is SELECT name FROM t WHERE status = 'active'. Why does an index on (status) alone fail to be a covering index for it?

    Show the answer

    Answer: d · Because the index lacks the name column, forcing heap lookups to fetch it

    Covering requires every referenced column, including projected ones, to live in the index; without name the engine must visit the heap. The other options misstate cardinality rules and falsely claim single-column or filter-column limits.

    Read the full bite: What is a covering index?

  12. Question 12 of 30

    Why is a hash index a poor choice for a query using WHERE price BETWEEN 10 AND 50 ORDER BY price?

    Show the answer

    Answer: c · Hashing discards key ordering, so it cannot scan ranges or return sorted rows

    A hash index maps keys to buckets with no ordering, making range scans and ORDER BY impossible to serve. The other claims are false: hash can be fast for equality, supports numeric and non-unique keys.

    Read the full bite: B-Tree versus Hash indexes

  13. Question 13 of 30

    What is the main trade-off when increasing checkpoint frequency?

    Show the answer

    Answer: b · Faster recovery but more frequent dirty-page flush I/O during normal operation

    More frequent checkpoints bound replay work so recovery is faster, but they flush dirty pages more often, adding write I/O and latency risk at runtime. Checkpoints do not truncate the WAL or weaken durability.

    Read the full bite: Database checkpoints with WAL

  14. Question 14 of 30

    Why can inserting rows with random primary-key values degrade a clustered (index-organized) table more than a heap?

    Show the answer

    Answer: a · Clustered tables must place each row in key order, causing mid-tree page splits and fragmentation

    A clustered table physically orders rows by key, so random keys force insertions into the middle and trigger page splits, while a heap simply appends. The last option reverses the definitions; heaps are unordered.

    Read the full bite: Heap file versus clustered index

  15. Question 15 of 30

    At COMMIT for a row update, what must be durably written before the database acknowledges success?

    Show the answer

    Answer: b · The WAL records for the transaction, fsynced to disk; the dirty data page is flushed later

    Write-ahead logging requires only the log records to be durably flushed at commit; the dirty data page is written back asynchronously by a checkpoint. Forcing the data page or syncing nothing both violate the WAL durability model.

    Read the full bite: Lifecycle of a single row update

  16. Question 16 of 30

    After locating the leaf page holding the lower bound, how does a B+ Tree efficiently return the rest of a range?

    Show the answer

    Answer: a · It follows the sorted linked list between leaf pages, reading consecutive leaves until the upper bound

    Leaf pages are linked in sorted order, so the engine simply walks that chain from the start key onward, avoiding repeated root descents. Re-traversing per row or loading the whole tree would be far more expensive.

    Read the full bite: B+ Tree range queries across pages

  17. Question 17 of 30

    When would a sort-merge join be clearly preferable to a hash join?

    Show the answer

    Answer: a · When both inputs already arrive sorted on the join key or the output must be ordered

    Sort-merge avoids sort cost when inputs are pre-sorted and produces ordered output for free, making it ideal there. Plentiful memory with equality and a tiny build side are exactly the conditions that favor a hash join.

    Read the full bite: Hash join versus sort-merge join

  18. Question 18 of 30

    Why must a database use external merge sort rather than a normal in-memory sort for a 100GB ORDER BY with 1GB of RAM?

    Show the answer

    Answer: c · The data far exceeds RAM, so it is sorted as memory-sized runs on disk and then merged

    Because the dataset dwarfs available memory, the engine sorts memory-sized chunks into runs on disk and merges them in passes. In-memory sorts have no fixed row cap, and the engine uses memory when data does fit.

    Read the full bite: Sorting data larger than memory

  19. Question 19 of 30

    Why is embedding the full list of liking user IDs inside each post document a poor choice for a popular social platform?

    Show the answer

    Answer: b · The liker array is unbounded, so it can exceed the document size limit and forces rewriting the whole document on each like

    Unbounded growth collides with the document size cap and causes costly full-document rewrites and contention per like. Document stores do support arrays and offer lookups, so the other options are false.

    Read the full bite: Embed or reference likes in a document database?

  20. Question 20 of 30

    Which feature is the clearest case where eventual consistency would be unacceptable and strong consistency is required?

    Show the answer

    Answer: c · Decrementing the remaining stock of a limited-edition item at checkout

    Limited inventory must be strongly consistent or two buyers could purchase the same last unit. View counts, follower counts, and feeds tolerate brief staleness without causing real harm.

    Read the full bite: What are eventual consistency and the BASE model?

  21. Question 21 of 30

    Which architectural property of Cassandra most directly removes a write bottleneck for a high-write user profile service?

    Show the answer

    Answer: a · A masterless peer-to-peer design where any replica can accept writes, with data spread by consistent hashing

    Cassandra's leaderless ring lets any replica accept writes and spreads them via consistent hashing, eliminating a single write bottleneck. A single primary, synchronous all-replica writes, and joins would each constrain rather than help write throughput.

    Read the full bite: Why fit Cassandra to a high-read, high-write workload?

  22. Question 22 of 30

    Which trade-off most accurately captures star versus snowflake schemas?

    Show the answer

    Answer: b · Star schemas use fewer joins and simpler faster queries; snowflake schemas normalize dimensions to cut redundancy at the cost of more joins

    Stars denormalize for fewer joins and faster queries, while snowflakes normalize dimensions to reduce redundancy but add joins. More joins do not speed queries, stars use more storage, and both keep a fact table.

    Read the full bite: Star schema vs snowflake schema trade-offs?

  23. Question 23 of 30

    Why does columnar storage accelerate an aggregation like AVG over one column across many rows?

    Show the answer

    Answer: c · It stores each column contiguously, so the engine reads only the needed column and skips the rest, scanning far less data

    Columnar layout co-locates a column's values, letting the engine read only that column and skip the others, cutting I/O sharply, with better compression on top. Row co-location, precomputing all aggregates, and avoiding compression are not how it works.

    Read the full bite: How does columnar storage speed up analytics?

  24. Question 24 of 30

    How does a Type 2 slowly changing dimension correctly preserve history when a customer's address changes?

    Show the answer

    Answer: b · It inserts a new row with a new surrogate key, validity dates, and a current flag, expiring the old row

    Type 2 versions the dimension by adding a new row with a new surrogate key and validity dates while expiring the prior row, so facts stay tied to the version current at their time. Overwriting is Type 1, and the two-column approach is Type 3.

    Read the full bite: What is a Type 2 slowly changing dimension?

  25. Question 25 of 30

    A banking ledger refuses writes on a node it cannot safely coordinate during a network partition. How does this position it on the CAP trade-off?

    Show the answer

    Answer: d · It is a CP system sacrificing availability to preserve consistency during the partition

    Refusing writes to avoid divergence trades availability for consistency, the defining behavior of a CP system under partition. Serving despite staleness would be AP, and CAP's trade-off cannot be escaped in a distributed system.

    Read the full bite: Apply the CAP theorem to a real system

  26. Question 26 of 30

    What is the central trade-off between range-based and hash-based sharding?

    Show the answer

    Answer: a · Range sharding enables efficient range scans but risks hot spots on monotonic keys; hash sharding spreads load evenly but makes range queries inefficient

    Range sharding keeps ordered keys together for fast range scans but concentrates monotonic writes on one shard, while hashing distributes load evenly at the cost of efficient range queries. The other options invert these properties.

    Read the full bite: Range-based vs hash-based sharding trade-offs?

  27. Question 27 of 30

    A team moves from leader-follower to multi-leader replication across two regions. Which new problem must they now explicitly design for?

    Show the answer

    Answer: b · Concurrent conflicting writes to the same record

    Multiple leaders accepting writes asynchronously means two regions can edit the same record concurrently, requiring conflict resolution. Stale read replicas also exist in plain leader-follower, so that is not the new problem multi-leader introduces.

    Read the full bite: Leader-follower vs multi-leader replication

  28. Question 28 of 30

    Which feature is the WEAKEST candidate for eventual consistency and most likely needs strong consistency instead?

    Show the answer

    Answer: b · Decrementing limited inventory at checkout

    Selling the same last unit twice due to a stale read causes real harm, so inventory decrement at checkout needs strong consistency. Like counts, follower numbers, and trending lists tolerate brief staleness without consequence.

    Read the full bite: What is eventual consistency?

  29. Question 29 of 30

    Why can setting a connection pool's maximum size too high actually hurt overall throughput?

    Show the answer

    Answer: b · It can exceed the database's connection limit and cause resource thrashing

    Too many connections can exhaust the database's connection ceiling and memory and cause excessive context switching, lowering throughput. Larger pools do not force reconnects or disable prepared statements, and drivers do not cap pools at 10.

    Read the full bite: Connection pooling and its key parameters

  30. Question 30 of 30

    Besides a base backup, what is the essential component that makes Point-in-Time Recovery possible?

    Show the answer

    Answer: c · A continuous archive of the write-ahead/transaction log

    PITR replays archived write-ahead log records over a base backup to reach a precise moment, so the log archive supplies the granularity. A replica or cache snapshot does not let you rewind to an arbitrary past instant.

    Read the full bite: Point-in-Time Recovery (PITR)

Could you explain these out loud?

That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon