postgresql/contrib/pageinspect/sql
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
..
brin.sql Add empty BRIN ranges during CREATE INDEX 2023-12-08 17:14:32 +01:00
btree.sql Add bt_multi_page_stats() function to contrib/pageinspect. 2023-01-02 13:02:29 -05:00
checksum.sql Add an explicit test to catch changes in checksumming calculations. 2020-03-08 15:09:14 -04:00
gin.sql pageinspect: Fix handling of all-zero pages 2022-04-14 15:08:03 +09:00
gist.sql pageinspect: Fix gist_page_items() with included columns 2023-05-19 12:37:58 +09:00
hash.sql pageinspect: Fix handling of all-zero pages 2022-04-14 15:08:03 +09:00
oldextversions.sql pageinspect: Improve page_header() for pages of 32kB 2021-07-12 11:05:27 +09:00
page.sql Prevent instability in contrib/pageinspect's regression test. 2022-11-21 10:50:50 -05:00