Official source
Postgres Pro
Free electronic version of the book on the Postgres Professional website.
Guide to Databases
Authors: V. I. Komarov
Publisher: DMK Press, 2024
Length: 520 pages
Tutorial from PostgreSQL: relational model, SQL, DBMS architecture, distributed systems and NoSQL.
OriginalWhy read this book?
The book is ideal for those who want:
- Get fundamental knowledge - understand the theoretical foundations of DBMS, from relational algebra to transactional processing
- Master SQL at a professional level - from basic queries to complex window functions and recursive CTEs
- Understand the architecture of the DBMS — how indexes, transactions, replication and distributed systems work
- Prepare for the interview - the book covers all database topics that are asked about System Design
Related chapter
PostgreSQL from the inside
Deep dive into MVCC, WAL, locks and PostgreSQL indexes from Egor Rogov.
Features of the book
Educational format
The book is written as a textbook with practical tasks, test questions and laboratory work. Ideal for self-study.
Relevance
Covers modern topics: NoSQL databases, distributed systems, big data processing, CAP theorem and eventual consistency.
Practical Focus
The theory is supported by examples in PostgreSQL. All concepts can be immediately put into practice with a real DBMS.
Free access
The book is available for free in electronic format on the Postgres Professional website - a quality resource without barriers.
Related chapter
Database Internals
Deep dive into B-Trees, LSM-Trees and distributed systems from Alex Petrov.
Book structure
Part I: Introduction to Databases
Fundamentals of database theory: from file systems to DBMS, relational model, normalization, ER diagrams and schema design.
Codd, relationships, keys
1NF → BCNF, denormalization
Entities, relationships, attributes
Logical and physical model
Part II: SQL Language
Complete SQL course: from SELECT to complex analytical queries, DDL/DML, window functions, CTE and query optimization.
SELECT, INSERT, UPDATE, DELETE
INNER, LEFT, RIGHT, FULL, CROSS
ROW_NUMBER, RANK, LAG, LEAD
WITH, recursive queries
Part III: DBMS Architecture
DBMS internals: data storage, indexes, buffer cache, transactions, locks and failure recovery.
Pages, heap, TOAST
B-Tree, Hash, GiST, GIN
ACID, isolation levels
Logging, checkpoint
Part IV: Distributed Systems
Replication, sharding, distributed transactions, CAP theorem, consensus and modern approaches to scaling.
Master-Slave, Master-Master
Horizontal partitioning
Consistency, Availability, Partition
Paxos, Raft, 2PC
Part V: NoSQL and Big Data
Alternatives to relational DBMS: document stores, key-value, column-family, graph databases and big data ecosystem.
MongoDB, CouchDB
Redis, Memcached, DynamoDB
Cassandra, HBase
Neo4j, JanusGraph
Сравнение типов NoSQL баз данных
Document Store
Документы (JSON/BSON) с вложенной структурой. Гибкая схема, богатые запросы по полям.
Примеры
Use Cases
Модель данных
JSON/BSON документы
Query Pattern
Запросы по полям, индексы
Consistency
tunable
Транзакции
| Характеристика | Key-Value | Document Store | Column-Family | Graph Database |
|---|---|---|---|---|
| Масштабирование | Horizontal | Horizontal | Horizontal | Both |
| Консистентность | eventual | tunable | tunable | strong |
| Схема | schemaless | flexible | flexible | flexible |
| Транзакции | ||||
| JOINs |
💡 Когда выбирать NoSQL вместо SQL?
- Key-Value: нужна максимальная скорость и простые lookup-операции
- Document: гибкая схема, nested data, эволюция структуры
- Column-Family: write-heavy workloads, time-series, огромные объёмы
- Graph: сложные связи между сущностями, многоуровневые обходы
Key Concepts for System Design
🔑Selecting a database type
- OLTP vs OLAP - different load patterns
- SQL vs NoSQL - trade-offs for different tasks
- Polyglot persistence - different databases for different data
- NewSQL - the best of both worlds
📊Indexing
- B-Tree for range queries and equality
- Hash for point lookups
- Composite indexes - column order is important
- Covering indexes - avoiding heap lookup
⚡Scaling
- Read replicas - read scaling
- Sharding - horizontal scaling
- Partitioning - managing large tables
- Connection pooling — PgBouncer, ProxySQL
🔒Consistency
- ACID - Transaction Guarantees
- Insulation levels - trade-off with performance
- Eventual consistency in distributed systems
- Saga pattern for distributed transactions
Who is this book for?
For beginners
Students and developers without database experience
Backend developers
To systematize knowledge and fill gaps
Preparing for an interview
Comprehensive coverage of database topics
About the authors
The book was written by a team of authors from the company Postgres Professional - a leading Russian developer of solutions based on PostgreSQL. The company is known for its contributions to the development of PostgreSQL and the creation of educational materials of the highest quality.
Where to find the book
Verdict
The Database Guide is an excellent free resource for those who want to gain fundamental knowledge about databases in Russian. The book is especially valuable as a textbook: its structured presentation, practical tasks and relevant content make it an ideal choice for self-study. Recommended as a first step before diving into more specialized books like DDIA or Database Internals.
