↓Skip to main content

Database

SQL Basics
·3 mins
Algorithm Database Sql
Combining conditions in SELECT … WHERE, and NULL’s three-valued logic: any comparison with NULL is not true, so use IS NULL
Sharding, Hot Shards, And Cross-Shard Pain
·15 mins
Database Database Database-Scaling Sharding Hot-Shard Multi-Tenant
Shard-key choice as workload design, not just picking a column
Replication Lag And Replica Routing
·14 mins
Database Database Database-Scaling Replication Read-Replica Consistency
Database replication as a freshness and routing problem, not just read scaling
Transactions, Isolation, And MVCC
·17 mins
Database Database Transactions Isolation Mvcc Locking Oracle
A practical backend view of ACID, anomalies, MVCC, locks, and retry behavior
Composite Index And Query Triage
·13 mins
Database Database Composite-Index Query-Plan Oracle Sargability Query-Optimization
Reason about composite indexes through predicates, ordering, projection, plan shape, and write cost
B+Tree And Index Internals
·14 mins
Database Database Index Btree Query-Optimization Storage-Engine Query-Plan
Index reasoning through page reads, access paths, selectivity, row fetches, and write tax
LeetCode 584: Find Customer Referee
·1 min
LeetCode Easy Database Sql
LeetCode 584 note: referee_id != 2 misses NULLs, since comparing with NULL is unknown; add IS NULL explicitly
LeetCode 1757: Recyclable and Low Fat Products
·1 min
LeetCode Easy Database Sql
LeetCode 1757 note: both conditions must hold, so filter with WHERE … AND …
LeetCode 620: Not Boring Movies
·1 min
LeetCode Easy Database
LeetCode 620 note: odd id and description not ‘boring’, ordered by rating from high to low
LeetCode 596: Classes With at Least 5 Students
·1 min
LeetCode Easy Database
LeetCode 596 note: group by class with HAVING COUNT(DISTINCT student) >= 5; older test data had duplicate rows, so count distinct students
LeetCode 595: Big Countries
·1 min
LeetCode Easy Database
LeetCode 595 note: filter with WHERE and OR for an area of at least 3 million or a population of at least 25 million
LeetCode 197: Rising Temperature
·1 min
LeetCode Easy Database
LeetCode 197 note: self-join Weather on a one-day date difference with today warmer; compare dates with DATEDIFF, never ids