Start here
Build the right PostgreSQL mental model in 90 minutes
At the end of this route you should be able to run an instance, connect with psql, design a constrained table, change data inside a transaction, and use EXPLAIN to check how a query executes.
Remember five things first
- A PostgreSQL cluster contains databases; a database contains schemas; schemas contain tables, views, and functions.
- A client connects to one database. Cross-database access is not as direct as cross-schema access.
- Every statement runs in a transaction. Without explicit
BEGIN, clients normally auto-commit one statement at a time. - Constraints are part of the data model, not merely a backup for application validation.
- Indexes cost writes and maintenance. Inspect real plans before and after creating one.
The 90-minute route
Minutes 0–10: run and connect
Finish Quickstart and keep the local pg-guide container running.
Minutes 10–30: build a model
Read Data modeling. Create customers and orders; express facts with primary keys, foreign keys, CHECK, NOT NULL, and unique constraints.
Minutes 30–50: query it
Read the Query toolbox. Practice filters, joins, aggregates, CTEs, and windows. Name output columns explicitly; avoid SELECT * in durable interfaces.
Minutes 50–70: understand concurrency
Read Transactions and concurrency. Observe READ COMMITTED in two psql sessions, then protect a balance change with SELECT ... FOR UPDATE.
Minutes 70–90: verify performance
Read Indexes and EXPLAIN. Run EXPLAIN (ANALYZE, BUFFERS), add an index, and compare. A sequential scan is not automatically a problem.
Completion check
SELECT version();
SELECT current_database(), current_user;
SELECT schemaname, tablename
FROM pg_catalog.pg_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema');If you can explain these results and safely remove the practice container, you have completed the first stage.
Do not skip restore practice
A backup file is not evidence of recoverability. In the operations track, restore one into an empty database at least once.
Last updated on