#Infrastructure
446 posts
PostgreSQL in Practice #5 VACUUM and autovacuum: How Dead-Tuple Cleanup Works, and Tuning It
VACUUM sits at the center of PostgreSQL operational knowledge. The dead tuples MVCC leaves behind and VACUUM's three jobs (marking space reusable, refreshing the visibility map, preventing transaction ID wraparound), why autovacuum is usually enough and where its default thresholds fail (bigger tables get cleaned later), per-table scale factor tuning, the long-running transactions that block cleanup, bloat inspection queries, and why VACUUM FULL is dangerous.
SRE in Practice #3 Alert Design: Symptom-Based Alerting and Multiwindow Burn Rates
Designing alerting so that only pages worth waking a human survive: why to move from cause-based alerts (high CPU) to symptom-based alerts (user requests failing), the criterion that separates pages from tickets, building burn-rate alerts as combinations of short and long windows to cut both false positives and false negatives, and the operating routine that measures and reduces alert fatigue.
Terraform Basics #6 Dependencies and Repetition: depends_on, count vs for_each, and dynamic Blocks
How references double as dependencies that decide creation order, and the exceptional cases where depends_on is needed. We cover the notorious recreation trap that removing an item from the middle of a list triggers with count, the key-based safety of for_each and how to choose between the two, and dynamic blocks for repeating nested blocks.
PostgreSQL in Practice #4 Advanced Index Strategy: Partial, Composite, Covering — and GIN, BRIN
Building strategy on top of basics chapter 4's B-tree fundamentals: partial indexes that bake a WHERE condition into the index, covering indexes (INCLUDE) and the conditions for an Index Only Scan, choosing beyond B-tree (GIN, GiST, BRIN), finding unused indexes with pg_stat_user_indexes and cleaning them up, and index bloat with REINDEX CONCURRENTLY.
SRE in Practice #2 Operating the Error Budget: The Policy Document and Burn Rates
Turning the error budget from a concept into an operating tool: the error budget policy document that agrees on actions before the incident, the executive sign-off that makes feature freezes actually work, calculating the burn rate that expresses how fast the budget is being consumed, responding differently to fast burns and slow burns, and the practical patterns that wire the budget into release decisions.
Terraform Basics #5 State Explained: The tfstate File Structure and How plan Computes Changes
Opening the terraform.tfstate file to examine its structure, and explaining how plan computes changes by comparing three things: code, state, and the real infrastructure. We also cover the problem of sensitive values stored in plaintext and the rule against committing state, manipulation commands like state list, show, mv, and rm, and what happens when you lose your state.
PostgreSQL in Practice #3 The Performance Diagnostics Routine: Finding Slow Queries with pg_stat_statements
A standard routine from "the database is slow" to the culprit query. pg_stat_activity for what is happening right now (active queries, waits, long-running transactions), installing pg_stat_statements and its key columns (total_exec_time, mean_exec_time, calls) for finding expensive queries in cumulative statistics, why top-by-total and top-by-mean point at different culprits, configuring the slow query log (log_min_duration_statement), and the handoff to EXPLAIN.
SRE in Practice #1 Designing SLIs and SLOs: What to Measure and How Many Nines to Promise
First post in the SRE in Practice series, on actually designing SLIs and SLOs: picking what to measure from user journeys, why good SLIs take the good/total ratio form, the trade-offs between measuring at the load balancer, the server, or the client, why SLO targets must start from current performance rather than aspiration, choosing the measurement window, and what an SLO specification document must contain.
Terraform Basics #4 Data Sources and Expressions: Reading Instead of Creating, Conditionals, and for
Covering the data block that reads information from existing resources Terraform did not create, using a latest-AMI lookup as the example, then building per-environment branches with conditionals and transforming lists and maps with for expressions and splat syntax. We also go through the built-in functions you will use most and terraform console, the playground for trying expressions.
PostgreSQL in Practice #2 Connection Pooling: The max_connections Misconception and PgBouncer
The connection problem every growing service hits. Why a PostgreSQL connection is expensive (each is a process), why raising max_connections is not the answer (too many connections actually lower throughput), the division of labor between application pools and external poolers like PgBouncer, what PgBouncer transaction mode buys and what it forbids (session-state features), and a working sense of pool sizing.
Terraform Basics #3 Variables, Outputs, and Locals: Three Tools for Removing Hardcoded Values
How to pull values out of your code with variable blocks, and the precedence among the four input paths — tfvars files, the -var-file and -var flags, and environment variables. We block bad values at the door with validation, expose results with output, and name internal computations with locals, laying the groundwork for building multiple environments from the same code.
PostgreSQL in Practice #1 Schema Migrations: Changing Tables Without Stopping the Service
The practice series opens with the craft of changing tables that are live in production. Why migrations must be managed as code (ordering and reproducibility), PostgreSQL's strength of transactional DDL, telling dangerous changes from safe ones by lock strength and duration, splitting NOT NULL into stages, CREATE INDEX CONCURRENTLY, and solving column renames and type changes with the expand-contract strategy.