Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

4330 bites

Page 211

Databases & Architecture2 min read

Explain database indexes, the classic data structure, and write-heavy trade-offs

Tests the read-write trade-off of indexing. A strong answer names B-Trees, explains they avoid full scans, and notes that inserts, updates, and deletes must update the index, adding write amplification and storage cost. Red flag: claiming indexes are free.

Databases & Architecture2 min read

Find users who never placed an order and explain JOIN choice

This tests SQL anti-joins and NULL semantics. A strong answer uses LEFT JOIN with IS NULL or NOT EXISTS, explains why NOT IN is risky with NULLs, and why NOT EXISTS is preferred. Red flag: using INNER JOIN or ignoring NULLs.

Databases & Architecture2 min read

What is the difference between WHERE and HAVING in SQL?

Tests SQL execution order and aggregation. A strong answer states WHERE filters rows before grouping, HAVING filters groups after aggregation, and gives an aggregate example that WHERE cannot evaluate.

Databases & Architecture1 min read

Read Committed versus Serializable isolation levels

Name the four levels, map each anomaly (dirty read, non-repeatable read, phantom) to the level that blocks it.

Databases & Architecture1 min read

Diagnosing and fixing the N+1 query problem

Define the 1 parent plus N child queries, fix via JOIN or batched IN, and ORM eager loading.

Databases & Architecture1 min read

When to intentionally denormalize a schema

Identify read-heavy join cost, duplicate or precompute data, and own the consistency burden.

Databases & Architecture1 min read

Normalizing a flat orders table to 3NF

Split repeating data, remove partial dependencies, remove transitive dependencies, define keys.

Databases & Architecture1 min read

Modeling one-to-many versus many-to-many relationships

One-to-many uses a foreign key on the many side; many-to-many needs a junction table with two foreign keys.

Databases & Architecture1 min read

Adjacency List versus Nested Set for hierarchies

Adjacency list is simple writes but recursive reads; nested set is fast subtree reads but costly writes.

Databases & Architecture1 min read

3NF versus BCNF and the overlapping-key gap

BCNF requires every determinant be a superkey; 3NF allows exceptions for prime attributes.

Databases & Architecture1 min read

Polymorphic associations and referential integrity

A single column can't FK two tables, so integrity is unenforced; alternatives use exclusive arcs or per-type tables.

Databases & Architecture1 min read

Relational versus wide-column for a news feed

Relational gives flexible joins but read-time fan-out; Cassandra precomputes per-user feed rows for fast writes-side fan-out.

Databases & Architecture1 min read

Shard key impact on uniqueness and cross-shard lookups

Uniqueness and FKs hold only within a shard; non-shard-key lookups need scatter-gather or a secondary index.

Databases & Architecture1 min read

The ACID properties of transactions

Define Atomicity, Consistency, Isolation, Durability and why each matters.

Databases & Architecture1 min read

The lost update anomaly explained

Both transactions read the same value, each adds one, the second overwrite erases the first.

Databases & Architecture1 min read

Database deadlocks and how engines resolve them

Define a deadlock as mutual waiting on locks, name detection plus victim rollback, and prevention by consistent lock ordering.

Databases & Architecture1 min read

How MVCC enables non-blocking reads

Writers create new row versions instead of overwriting, readers see a consistent snapshot, so readers never block writers.

Databases & Architecture1 min read

Two-Phase Locking and serializability

A growing phase only acquires locks, a shrinking phase only releases, no lock taken after one is freed.

Databases & Architecture1 min read

Write skew under snapshot isolation

Two transactions read an overlapping set, each writes disjoint rows, jointly violating an invariant.

Databases & Architecture1 min read

How the write-ahead log ensures atomicity and durability

Log changes before applying, flush log at commit, replay redo and undo on recovery.