Skip to main content
Databases

PostgreSQL Tutorial with Examples.

PostgreSQL tutorial with examples: JSONB, full-text search, partitioning, EXPLAIN ANALYZE and performance tuning in the open-source database.

Intermediate

For developers with core concepts down

6 lessons
postgresql intermediate
5 min read

EXPLAIN shows what the planner guesses a query will cost; EXPLAIN ANALYZE actually runs it and shows what really happened. Confusing the two means trusting an estimate that may be wrong.

postgresql intermediate
5 min read

Indexing a low-selectivity column barely moves the needle — 13ms to 13ms — while indexing a high-selectivity one drops a query from 14ms to 1ms. Selectivity, not the presence of an index, is what determines the payoff.

postgresql intermediate
5 min read

A B-tree index on a jsonb column compiles, exists, and does absolutely nothing for a containment query — the operator has to match the index type, not just the column.

postgresql intermediate
5 min read

Deleting 80% of a table's rows doesn't shrink it by a single byte, and neither does a plain VACUUM. Only VACUUM FULL actually returns space to the OS — by rewriting the whole table under an exclusive lock.

postgresql intermediate
5 min read

One error inside a transaction poisons every statement after it until ROLLBACK — and two transactions locking the same two rows in opposite order produces a real 'deadlock detected' error, not a hang.

postgresql intermediate
5 min read

Every committed write has to hit durable storage before COMMIT returns — turning that guarantee off doesn't change what gets written, only when Postgres waits for it, and the difference is measured, not asserted.

Advanced

Production-grade patterns for experienced engineers

1 lesson

Also part of PostgreSQL

Taught in other topics. Each link opens the lesson in its home topic.

7 lessons