pgsql: Add empty BRIN ranges during CREATE INDEX

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема pgsql: Add empty BRIN ranges during CREATE INDEX
Дата
Msg-id E1rBdW8-009DdC-Hb@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dae761a87edae444d11a411f711f1d679bed5941

Modified Files
--------------
contrib/pageinspect/expected/brin.out |  18 +++++
contrib/pageinspect/sql/brin.sql      |  17 +++++
src/backend/access/brin/brin.c        | 121 ++++++++++++++++++++++++++++++++--
3 files changed, 152 insertions(+), 4 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: pgsql: llvmjit: Use explicit LLVMContextRef for inlining
Следующее
От: Tomas Vondra
Дата:
Сообщение: pgsql: Allow parallel CREATE INDEX for BRIN indexes