postgresql/src
Tomas Vondra dae761a87e Add empty BRIN ranges during CREATE INDEX
When building BRIN indexes, the brinbuildCallback only advances to the
next page range when seeing a tuple that doesn't belong to the current
one. This means that the index may end up missing ranges at the end of
the table, if those pages do not contain any indexable tuples.

We tend not to have completely empty pages at the end of a relation, but
this also applies to partial indexes, where the tuples may simply not
match the index predicate. This results in inefficient scans using the
affected BRIN index - without the summaries, the page ranges have to be
read and processed, which consumes I/O and possibly also CPU time.

The existing code already added empty ranges for earlier parts of the
table, this commit makes sure we add them for the ranges at the end of
the table too.

Patch by Matthias van de Meent, with review/improvements by me.

Author: Matthias van de Meent
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/CAEze2WiMsPZg%3DxkvSF_jt4%3D69k6K7gz5B8V2wY3gCGZ%2B1BzCbQ%40mail.gmail.com
2023-12-08 17:14:32 +01:00
..
backend Add empty BRIN ranges during CREATE INDEX 2023-12-08 17:14:32 +01:00
bin Fix path of regress shared library in pg_upgrade test 2023-12-08 10:36:23 +09:00
common Shrink Unicode category table. 2023-12-07 15:44:03 -08:00
fe_utils Remove unneeded assignments in for loop header 2023-11-21 16:10:27 +01:00
include Rename ShmemVariableCache to TransamVariables 2023-12-08 09:47:15 +02:00
interfaces Fix handling of errors in libpq pipelines 2023-12-05 12:43:24 +01:00
makefiles Remove distprep 2023-11-06 15:18:04 +01:00
pl Don't specify number of dimensions in cases where we don't know it. 2023-11-17 11:29:46 -05:00
port Optimize pg_readv/pg_pwritev single vector case. 2023-11-29 17:19:25 +13:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Test that it works to RESET an invalid reloption 2023-12-08 11:58:58 +01:00
timezone Remove distprep 2023-11-06 15:18:04 +01:00
tools Rename ShmemVariableCache to TransamVariables 2023-12-08 09:47:15 +02:00
tutorial Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Don't clean initdb files on template creation failure 2023-12-08 13:42:54 +01:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
meson.build Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00