Databases in Depth
How PostgreSQL stores, versions and finds your data, then Redis, MongoDB and ClickHouse, and how to choose between them.
Tests check every exercise: in your browser and in the cloud
Syllabus
- Pages and the heapTheory
- Quiz — pages and the heapQuiz
- Inside a pageTheory
- Quiz — inside a pageQuiz
- Exercise: rows and free space per pageExercise
- TOAST: long valuesTheory
- Quiz — TOASTQuiz
- Exercise: what a table's size is made ofExercise
- The buffer cacheTheory
- Quiz — the buffer cacheQuiz
- Exercise: pages in the cacheExercise
- Row versionsTheory
- Quiz — row versionsQuiz
- Snapshots and visibilityTheory
- Quiz — snapshots and visibilityQuiz
- Exercise: versions on the pageExercise
- VACUUM and dead tuplesTheory
- Quiz — VACUUMQuiz
- Exercise: the share of dead tuplesExercise
- Exercise: cleaning up the menuExercise
- Freezing and wraparoundTheory
- Quiz — freezing and wraparoundQuiz
- Access methods and the hash indexTheory
- Quiz — access methods and hashQuiz
- GIN: the inverted indexTheory
- Quiz — GINQuiz
- Exercise: baskets through GINExercise
- GiST and BRINTheory
- Quiz — GiST and BRINQuiz
- Partial and expression indexesTheory
- Quiz — partial and expression indexesQuiz
- Exercise: one senior barista per shopExercise
- Covering indexesTheory
- Exercise: an index for the shop reportExercise
- The cost of an indexTheory
- Quiz — covering indexes and write costQuiz
- Statistics and row estimatesTheory
- Quiz — statistics and row estimatesQuiz
- Exercise: estimates from common valuesExercise
- Plan costTheory
- Quiz — plan costQuiz
- Exercise: the cost of a full scanExercise
- Reading EXPLAIN ANALYZETheory
- Quiz — reading EXPLAIN ANALYZEQuiz
- Join algorithmsTheory
- Quiz — join algorithmsQuiz
- When estimates go wrongTheory
- Quiz — when estimates go wrongQuiz
- Exercise: statistics on two columnsExercise
- json and jsonbTheory
- Quiz — json, jsonb and ->>Quiz
- Searching JSONB documentsTheory
- Quiz — searching JSONBQuiz
- Exercise: a light oat-milk drinkExercise
- Building and changing documentsTheory
- Quiz — changing documentsQuiz
- Exercise: the season is overExercise
- Full-text searchTheory
- Quiz — tsvector and tsqueryQuiz
- Ranking, indexes and trigramsTheory
- Quiz — indexes for text searchQuiz
- Exercise: reviews about sweetnessExercise
- Big tables and partitionsTheory
- Kinds of partitioningTheory
- Quiz — partitions and boundsQuiz
- Exercise: orders by monthExercise
- Partition pruningTheory
- Quiz — partition pruningQuiz
- Exercise: the spring reportExercise
- Indexes on a partitioned tableTheory
- Quiz — indexes and keysQuiz
- Dropping and adding partitionsTheory
- Quiz — dropping and adding partitionsQuiz
- Exercise: old and new quartersExercise
- Choosing the key and the countTheory
- Quiz — the key and the countQuiz
- Streaming replicationTheory
- Quiz — streaming replicationQuiz
- Synchronous and asynchronous replicasTheory
- Quiz — synchronous and asynchronous replicasQuiz
- Logical replicationTheory
- Quiz — logical replicationQuiz
- Connection pooling and PgBouncerTheory
- Quiz — connection poolingQuiz
- ShardingTheory
- Quiz — shardingQuiz
- CAP and PACELCTheory
- Quiz — CAP and PACELCQuiz
- Keys and stringsTheory
- Quiz — keys and countersQuiz
- Hashes and listsTheory
- Exercise: Anna's cartExercise
- Sets and sorted setsTheory
- Quiz — choosing a structureQuiz
- Exercise: the sales boardExercise
- Key time to liveTheory
- Quiz — key time to liveQuiz
- Exercise: the price cacheExercise
- EvictionTheory
- Quiz — evictionQuiz
- Caching patternsTheory
- Quiz — caching patternsQuiz
- Transactions: MULTI and WATCHTheory
- Exercise: a new latte priceExercise
- Lua scriptsTheory
- Quiz — transactions and scriptsQuiz
- Exercise: the order numberExercise
- Rate limitingTheory
- Exercise: the sliding windowExercise
- Streams and consumer groupsTheory
- Quiz — rate limits and streamsQuiz
- Persistence: RDB and AOFTheory
- Quiz — persistenceQuiz
- Documents and collectionsTheory
- Quiz — documents and _idQuiz
- Filters, projection and sortTheory
- Exercise: drinks without sugarExercise
- Nested fields, arrays and nullTheory
- Quiz — filters, arrays and nullQuiz
- Exercise: reviews to answerExercise
- Changing documentsTheory
- Quiz — updates and atomicityQuiz
- Exercise: a reply to a reviewExercise
- Embed or referenceTheory
- Quiz — embed or referenceQuiz
- The aggregation pipelineTheory
- Quiz — groups and accumulatorsQuiz
- Exercise: what customers spendExercise
- $unwind, $lookup and stage orderTheory
- Quiz — $unwind, $lookup and stage orderQuiz
- Exercise: the most profitable itemsExercise
- Exercise: the rating boardExercise
- Indexes and explain()Theory
- Quiz — indexes and explain()Quiz
- Replica setsTheory
- Quiz — replica setsQuiz
- ShardingTheory
- Quiz — shardingQuiz
- Rows and columnsTheory
- Quiz — rows and columnsQuiz
- Exercise: revenue by payment methodExercise
- MergeTree: parts and mergesTheory
- Quiz — parts and mergesQuiz
- Sort key and sparse indexTheory
- Quiz — sort key and indexQuiz
- Exercise: a table for item salesExercise
- PartitionsTheory
- Quiz — partitionsQuiz
- Mutations: UPDATE and DELETETheory
- Exercise: delete a monthExercise
- Quiz — mutationsQuiz
- Aggregate functions and combinatorsTheory
- Quiz — aggregate functionsQuiz
- ReplacingMergeTree: the latest row versionTheory
- Quiz — ReplacingMergeTreeQuiz
- Exercise: order statusesExercise
- SummingMergeTree: sums on mergeTheory
- Quiz — SummingMergeTreeQuiz
- Materialized viewsTheory
- Quiz — materialized viewsQuiz
- AggregatingMergeTree and function statesTheory
- Exercise: paying users by monthExercise
- Quiz — function statesQuiz
- Where reports liveTheory
- Quiz — reports, change capture and KafkaQuiz
- The LSM treeTheory
- Quiz — the LSM treeQuiz
- LSM tree vs B-treeTheory
- Quiz — LSM tree vs B-treeQuiz
- Cassandra, Elasticsearch and vectorsTheory
- Quiz — Cassandra, Elasticsearch, vectorsQuiz
- How to choose a databaseTheory
- Quiz — choosing a databaseQuiz
- Exercise: the daily reportExercise
- Exercise: reading a price through the cacheExercise
- Exercise: cappuccino and croissantExercise
- Exercise: the next pageExercise
- Exercise: releasing the report lockExercise
- Exercise: the helpful voteExercise
- Exercise: the top items of each shopExercise
- The whole coffee chain on one diagramTheory