Title card with connected panels labeled OBSERVE, DECIDE, and ACT.

INSERT ... ON CONFLICT turns a race into one statement

INSERT … ON CONFLICT lets PostgreSQL resolve an insert collision inside the statement that performs the write. It replaces a fragile “check whether the key exists, then insert” sequence with an explicit conflict policy backed by an eligible index or constraint. It does not turn every insertion error into a successful update or define the application’s merge policy for you. ...

March 25, 2027 · 5 min · XB Field Notes
Title card with connected panels labeled OBSERVE, DECIDE, and ACT.

EXPLAIN estimates need execution context

EXPLAIN describes the plan PostgreSQL intends to execute. EXPLAIN ANALYZE executes that plan and adds measurements. Comparing them is useful only after interpreting what each number counts. An apparent mismatch can reflect stale estimates, repeated execution, or a parent that stopped requesting rows. Matching cardinalities strengthen one part of the model; they do not prove the chosen plan is the fastest possible plan. ...

March 19, 2027 · 4 min · XB Field Notes
Title card with connected panels labeled OBSERVE, DECIDE, and ACT.

ANALYZE updates the estimates the planner relies on

ANALYZE updates the statistical model PostgreSQL uses to estimate query results. It does not rewrite the query, rebuild its indexes, remove dead tuples, or promise a faster plan. Its useful question is specific: does the planner understand the current distribution well enough to compare access paths? A bulk status change can invalidate that understanding even when the table still contains exactly the same number of live rows. ...

March 12, 2027 · 4 min · XB Field Notes
Cover for window frames, with a title beside linked observe, decide and act panels on a pale grid.

A window frame decides which rows one aggregate sees

A window partition determines which rows belong together; a window frame determines which of those rows feed a frame-sensitive calculation for the current row. Confusing these boundaries can turn a running total into a repeated subtotal or make last_value return the current value when the report expected the final value in the partition. ...

February 23, 2027 · 5 min · XB Field Notes
Title card with connected panels labeled OBSERVE, DECIDE, and ACT.

A pool shares a few Postgres connections among many requests

A connection pool lets many application requests borrow a smaller number of PostgreSQL sessions over time. Reuse amortizes connection setup and limits simultaneous leases, but does not make an overloaded database faster by itself. The pool creates another queue whose capacity, waiting time, and cancellation behavior belong to the request budget. Treat that queue as part of the service, not as an invisible implementation detail. ...

February 13, 2027 · 5 min · XB Field Notes
Title card with connected panels labeled OBSERVE, DECIDE, and ACT.

Choose B-tree or hash from the required operations

PostgreSQL’s default B-tree index supports several common query requirements: equality, ranges, ordered access, and uniqueness enforcement. A hash index supports a narrower equality access path. Choosing between them starts with the required operators and constraints, then proceeds to measurement. Saying that hashes are always faster for equality, or that PostgreSQL almost never chooses them, replaces a workload question with an unsupported generalization. ...

February 7, 2027 · 5 min · XB Field Notes
Title card with connected panels labeled OBSERVE, DECIDE, and ACT.

A transaction can fail and leave you to retry

A competing update does not automatically make a PostgreSQL transaction fail. The outcome depends on isolation, statement behavior, and the state another transaction commits. Treating every collision as the same retryable event can conceal invalid input or repeat a decision made from stale data. The useful boundary is a complete application operation whose reads and writes can be attempted again. ...

February 1, 2027 · 4 min · XB Field Notes
Title card with connected panels labeled OBSERVE, DECIDE, and ACT.

GROUPING SETS build several aggregate views

GROUPING SETS asks one SQL statement to produce several aggregation levels. A sales report can return totals by region and product, region subtotals, and a grand total together. The result contains different kinds of rows, so identifying each row’s level is as important as calculating its amount correctly. ...

January 15, 2027 · 5 min · XB Field Notes