Re: BRIN indexes vs. SK_SEARCHARRAY (and preprocessing scan keys)

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BRIN indexes vs. SK_SEARCHARRAY (and preprocessing scan keys)
Date: 2023-02-17 02:50:54
Message-ID: 57020b2e-d9c9-9bc7-4892-b36d9bb07563@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

cfbot identified a couple issues in the pathes:

1) not handling NULLs correctly (or rather at all). There was a FIXME,
so I took this as a sign it's time to finally address that.

2) minmax-multi did not fully adopt the preprocessed values in the
second part of the _consistent function

The patches also add a bunch of regression tests to improve coverage.

While adding those, I ran into an interesting behavior with BRIN bloom
indexes. If you have such index on a bigint column, then this won't use
the index:

SELECT * FROM t WHERE b = 82;

unless you cast the constant to bigint like this:

SELECT * FROM t WHERE b = 82::bigint;

I vaguely remember dealing with this while working on the bloom indexes,
and concluding this is OK. But what's interesting is that with multiple
values in the IN clause it works and this will use the index:

SELECT * FROM t WHERE b IN (82, 83);

That's a bit surprising.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
0001-BRIN-bloom-cleanup-20230217.patch text/x-patch 1.9 KB
0002-BRIN-minmax-multi-cleanup-20230217.patch text/x-patch 2.2 KB
0003-Introduce-bloom_filter_size-20230217.patch text/x-patch 3.5 KB
0004-Add-minmax-multi-inequality-tests-20230217.patch text/x-patch 16.8 KB
0005-Introduce-BRIN_PROCNUM_PREPROCESS-procedure-20230217.patch text/x-patch 4.8 KB
0006-Support-SK_SEARCHARRAY-in-BRIN-minmax-20230217.patch text/x-patch 69.5 KB
0007-Support-SK_SEARCHARRAY-in-BRIN-minmax-multi-20230217.patch text/x-patch 75.1 KB
0008-Support-SK_SEARCHARRAY-in-BRIN-inclusion-20230217.patch text/x-patch 22.8 KB
0009-Support-SK_SEARCHARRAY-in-BRIN-bloom-20230217.patch text/x-patch 41.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-02-17 03:00:09 Re: Change xl_hash_vacuum_one_page.ntuples from int to uint16
Previous Message Michael Paquier 2023-02-17 02:48:14 Re: Missing free_var() at end of accum_sum_final()?