~/talk

The ESR Equality Sort Range Rule of Composite Indexes

Talkat PGConf India 2025 · 2025-03-05..03-07· [databases]
slides:none on file

Explains a concrete rule for Postgres composite indexes: put all equality first columns, then range columns, then the columns used for ORDER BY/LIMIT so the index can produce the exact range and avoid a separate sort. Shows SQL examples on Postgres, demonstrates queries that drop a sort step and reduce row reads, and gives the tipping point: if the range predicate is more selective than the ORDER BY/LIMIT then range before sort when more selective yields the best performance.

AI-written summary · about

~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.