pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Pass all scan keys to BRIN consistent function at once
Date: Mon, 22 Mar 2021 23:55:22 +0000
Message-ID: <E1lOUOI-0007wG-4U@gemulon.postgresql.org> (raw)

Pass all scan keys to BRIN consistent function at once

This commit changes how we pass scan keys to BRIN consistent function.
Instead of passing them one by one, we now pass all scan keys for a
given attribute at once. That makes the consistent function a bit more
complex, as it has to loop through the keys, but it does allow more
elaborate opclasses that can use multiple keys to eliminate ranges much
more effectively.

The existing BRIN opclasses (minmax, inclusion) don't really benefit
from this change. The primary purpose is to allow future opclases to
benefit from seeing all keys at once.

This does change the BRIN API, because the signature of the consistent
function changes (a new parameter with number of scan keys). So this
breaks existing opclasses, and will require supporting two variants of
the code for different PostgreSQL versions. We've considered supporting
two variants of the consistent, but we've decided not to do that.
Firstly, there's another patch that moves handling of NULL values from
the opclass, which means the opclasses need to be updated anyway.
Secondly, we're not aware of any out-of-core BRIN opclasses, so it does
not seem worth the extra complexity.

Bump catversion, because of pg_proc changes.

Author: Tomas Vondra <tomas.vondra@postgresql.org>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Mark Dilger <hornschnorter@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: John Naylor <john.naylor@enterprisedb.com>
Reviewed-by: Nikita Glukhov <n.gluhov@postgrespro.ru>
Discussion: https://postgr.es/m/c1138ead-7668-f0e1-0638-c3be3237e812@2ndquadrant.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/brin.sgml                   |   8 +-
src/backend/access/brin/brin.c           | 116 +++++++++++++++++--------
src/backend/access/brin/brin_inclusion.c | 140 ++++++++++++++++++++++---------
src/backend/access/brin/brin_minmax.c    |  92 ++++++++++++++++----
src/backend/access/brin/brin_validate.c  |   4 +-
src/include/catalog/catversion.h         |   2 +-
src/include/catalog/pg_proc.dat          |   4 +-
7 files changed, 268 insertions(+), 98 deletions(-)



Message-ID: <E1lOUOI-0007wG-4U@gemulon.postgresql.org>
Permalink:  ../E1lOUOI-0007wG-4U@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lOUOI-0007wG-4U@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Pass all scan keys to BRIN consistent function at once
  In-Reply-To: <E1lOUOI-0007wG-4U@gemulon.postgresql.org>
  References: <E1lOUOI-0007wG-4U@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox