← Back to Databases

In-Database Automation Engine in PostgreSQL

Push work into the database and stop paying for chatty round-trips

Day 1: Anonymous Block (DO $$) & The Chatty Application Anti-Pattern

Learn PL/pgSQL DO blocks and why chatty apps lose to in-database logic.

View Day 1 →

Day 2: Storage Engine & Buffer Pool Mechanics

Keep logic next to 8KB pages in shared buffers so PL/pgSQL wins over chatty round-trips.

View Day 2 →

Day 3: Transaction Lock Contention & Concurrency Control

Idle-in-transaction, lock wait, and deadlock: the concurrency cost of holding a lock while the app talks over the network.

View Day 3 →

Day 4: Architecture Capstone & Phase 1 Synthesis

Phase 1 checkpoint: turn the chatty-app vs in-database map into a slide narrative.

View Day 4 →

Day 5: Pillar 1 — User-Defined Functions & Inlining

Move logic into PostgreSQL UDFs and understand inlining mechanics.

View Day 5 →

Day 6: Pillar 2 — Stored Procedures & Transaction Control

COMMIT and ROLLBACK inside procedures so chunked batch work releases locks safely.

View Day 6 →

Day 7: Pillar 3 — Event Triggers & Audit Logging

Catch schema and data events inside the database and write an audit trail.

View Day 7 →

Day 8: Pillar 4 — Materialized Views & pg_cron

Precompute heavy dashboards and refresh them concurrently on a schedule.

View Day 8 →

Day 9: Set-Based Logic & Parallel Query

Drop RBAR loops, think in sets, and let PostgreSQL use multiple cores.

View Day 9 →

Day 10: Phase 2 Synthesis & Capstone

Close Phase 2 of the 18-day masterclass before entering DevOps and architectural boundaries.

View Day 10 →

Day 11: Database-as-Code with Flyway / Liquibase

Versioned vs repeatable migrations, schema drift detection, and CI/CD for stored units.

View Day 11 →

Day 12: Automated Testing with Testcontainers & pgTAP

Shift-left database unit tests with pgTAP, ephemeral Testcontainers, and transactional isolation.

View Day 12 →

Day 13: Decision Matrix — App vs. DB Boundaries & CPU Protection

Keep CPU-bound work in the app and data-bound work in PostgreSQL so the database CPU stays protected.

View Day 13 →

Day 14: Architectural Trade-offs & Anti-patterns Summary

Compare trade-offs and the anti-patterns that break in-database automation, including cascading triggers and unsanitized dynamic SQL.

View Day 14 →

Day 15: Engineering Architecture Proposal & Tech Spec Pitch

Turn the architecture into a proposal and tech spec you can pitch to the software team.

View Day 15 →