One logical table with many physical pieces.

Table partitioning splits data by range or key

Range partitioning turns a boundary definition into a write-routing rule. PostgreSQL places a row in the partition whose bounds accept its key, whether the row arrives on time or months late. Correct boundaries, compatible timestamp types, and a plan for missing ranges matter before any query can benefit from pruning. ...

February 10, 2028 · 5 min · XB Field Notes
Rows retain their identities while receiving separate position and tied-rank values.

Window functions rank rows without collapsing groups

Ranking functions attach a position to each input row within a partition. They do not collapse a team, department, or customer into one aggregate row. The important choice is what a tie means: a unique position, a shared competition rank with gaps, or a shared rank counting distinct score groups. ...

February 8, 2028 · 5 min · XB Field Notes
A subquery expression that runs individually for every outer row.

LATERAL lets each row open its own subquery

LATERAL lets a FROM item refer to columns from preceding items. It is useful when each parent needs a small, differently parameterized result, such as its two newest orders. The query remains one SQL statement and one database round trip, while the lateral expression states which outer values determine each result. It does not promise one particular physical execution strategy. ...

January 19, 2028 · 5 min · XB Field Notes
A logical parent routes rows to physical partitions with separate indexes and lifecycles.

Partitioning splits one table into many pieces that look like one

Declarative partitioning lets PostgreSQL expose one logical table while storing its rows in separate partitions. The parent routes writes and provides a common query target; the physical partitions hold the data. Its strongest benefits often concern lifecycle management and selective access, but the choice also affects keys, query shape, and operational locking. ...

December 23, 2027 · 5 min · XB Field Notes
A named, top-level subquery that keeps a complex statement readable.

A Common Table Expression names a query you can reuse

A common table expression gives a query result a name within one SQL statement. It can make a complex report readable by naming populations and intermediate calculations before the final SELECT. That name is not a persistent table, and it does not by itself promise a cached result, a particular scan count, or a sequence of procedural steps. ...

December 19, 2027 · 5 min · XB Field Notes
A fixed SQL structure accepts bound values while the database can choose different execution plans.

Prepared statements separate values from SQL structure

Parameter binding gives a database value a designated position in a SQL statement. A name containing a quote or a semicolon remains a value instead of becoming another clause. Reusing a named prepared statement adds a separate optimization: the server can retain statement information across executions in one session. Safe binding does not require the application to create a named statement for every query. ...

October 16, 2027 · 5 min · XB Field Notes
A planner weighing cost estimates across join orders before choosing one.

Query planners bet on cost, not certainty

A query planner chooses an execution path using estimated work. It does not run every candidate, time them, and keep the winner. PostgreSQL compares possible scans, joins, sorts, and other operations using statistics and a cost model. The chosen plan is therefore a prediction under current assumptions. Understanding a wrong prediction requires identifying which assumption failed, rather than treating a sequential scan or a nested loop as inherently suspicious. ...

September 17, 2027 · 4 min · XB Field Notes
A sorted multi-column catalog with leading-key ranges and later-key lookup paths.

Composite indexes match multi-column queries

A composite B-tree index orders tuples by its first key, then by the next key within each first-key group. This structure can make a tenant-specific time range cheap to locate. The useful rule is about how much index space a predicate narrows, not a prohibition against mentioning later columns or writing WHERE conditions in a different textual order. ...

September 15, 2027 · 4 min · XB Field Notes