Skip to content

Database setup

From the repository root:

Terminal window
scripts/db setup
scripts/db psql

The first command initializes and seeds a project-local PostgreSQL cluster. The second opens psql against it.

Next, understand the sample data, open the original 24-exercise catalog, or continue to the 14 additional exercises. The raw worksheets are available at exercises.sql and more_exercises.sql.

Register a new server and use:

Field Value
Name Apple MLOps Lab
Host localhost
Port 55432
Maintenance database apple_mlops_lab
Username your macOS username
Password leave blank
SSL mode Disable
\dt
\d+ prediction_events
SELECT tableoid::regclass AS partition, count(*)
FROM prediction_events
GROUP BY 1
ORDER BY 1;

Serving

prediction_events contains 500,000 events spread across eight monthly partitions, including delayed labels and deterministic duplicate requests.

Training

Explore experiments, 15,000 training runs, 142,000 metrics, artifacts, and point-in-time dataset lineage.

Operations

Query pipelines, retry chains, quality checks, drift windows, deployments, traffic ramps, governance approvals, and incidents.

Performance

Practice partition pruning, composite and partial indexes, JSONB with GIN, materialized views, and EXPLAIN (ANALYZE, BUFFERS).

Terminal window
scripts/db status
scripts/db stop
scripts/db start
scripts/db reset
# Larger serving fact table:
APPLE_DB_SCALE=3 scripts/db reset