postgresql/src/backend
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
..
access Add empty BRIN ranges during CREATE INDEX 2023-12-08 17:14:32 +01:00
archive Redesign archive modules 2023-02-17 14:26:42 +09:00
backup Change how a base backup decides which files have checksums. 2023-11-14 10:51:05 -05:00
bootstrap Remove distprep 2023-11-06 15:18:04 +01:00
catalog Optimize SearchPathCache by saving the last entry. 2023-12-04 17:19:16 -08:00
commands Don't try to open visibilitymap when analyzing a foreign table 2023-12-08 09:16:21 +02:00
executor Verify that attribute counts match in ExecCopySlot 2023-12-07 21:28:24 +13:00
foreign Improve "user mapping not found" error message 2023-11-30 05:34:28 +01:00
jit Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
lib Make binaryheap available to frontend code. 2023-09-18 12:18:33 -07:00
libpq Apply quotes more consistently to GUC names in logs 2023-11-30 14:11:45 +09:00
main Remove obsolete defense against strxfrm() bugs. 2023-04-20 13:20:14 +12:00
nodes Remove distprep 2023-11-06 15:18:04 +01:00
optimizer Fix comment about ressortgrouprefs being unique in setop plans. 2023-11-28 14:15:14 +02:00
parser Clean up usage of bison precedence for non-operator keywords. 2023-11-28 13:32:15 -05:00
partitioning Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
po Translation updates 2023-08-07 12:39:30 +02:00
port Remove distprep 2023-11-06 15:18:04 +01:00
postmaster Remove some unnecessary #includes of postmaster/interrupt.h 2023-12-08 13:19:37 +02:00
regex Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
replication Fix indentation 2023-12-05 15:54:59 +01:00
rewrite Add TupleDescGetDefault() 2023-09-27 18:52:40 +01:00
snowball Remove distprep 2023-11-06 15:18:04 +01:00
statistics Retire MemoryContextResetAndDeleteChildren() macro. 2023-11-15 13:42:30 -06:00
storage Rename ShmemVariableCache to TransamVariables 2023-12-08 09:47:15 +02:00
tcop Add support for REINDEX in event triggers 2023-12-04 09:53:49 +09:00
tsearch Limit to_tsvector_byid's initial array allocation to something sane. 2023-09-25 11:50:28 -04:00
utils Rename ShmemVariableCache to TransamVariables 2023-12-08 09:47:15 +02:00
.gitignore
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build Add win32ver data to meson-built postgres.exe. 2023-06-12 07:40:38 -07:00
nls.mk Remove distprep 2023-11-06 15:18:04 +01:00