PostgreSQL
Раздел про PostgreSQL: ACID и уровни изоляции транзакций (MVCC, WAL, SSI), партиционирование и шардирование, covering index с INCLUDE, веса в полнотекстовом поиске (FTS). Объяснения с примерами на двух таблицах category и product.
Why it matters for UCP. PostgreSQL is the primary database for UCP services. ACID, isolation, and sharding are must-knows for a senior engineer at any maturity level. Part of the learning program.
Articles on how PostgreSQL is built and operated. Explanations use code examples on a consistent pair of tables (category + product), so it's easy to switch between articles.
Articles in this section
- ACID and transaction isolation levels — what the four letters mean, how PostgreSQL implements them (MVCC, WAL, snapshots, SSI), the four isolation levels with examples of the phenomena (dirty / non-repeatable / phantom read, write skew).
- Database size, partitioning, and sharding — how to estimate the size of a database and its tables, when to apply partitioning, when to shard, how to choose a partition key and a shard key.
- Covering Index (INCLUDE) —
INCLUDEvs simply extending the key, index-only scan, the visibility map subtlety,UNIQUE … INCLUDEfor returning "extra" fields. - FTS: weights and ranking —
setweightand the four levels A/B/C/D, a generated column withtsvector+ GIN,ts_rankvsts_rank_cd, common mistakes with dictionary language.
Related
- PG Style Guide — the rules for working with PostgreSQL in Java/Spring services (codes
R-PG-*). - jOOQ Style Guide — how to access PostgreSQL from Java via jOOQ, the repository pattern, multiset.
- Distributed Patterns Style Guide — saga, idempotency, outbox: how to ensure integrity beyond a single database.