Re: Building infrastructure for B-Tree deduplication that recognizes when opclass equality is also equivalence

From: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Building infrastructure for B-Tree deduplication that recognizes when opclass equality is also equivalence
Date: 2019-10-28 18:11:12
Message-ID: 207a201b-cec0-2446-6993-06306b613d48@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

01.10.2019 8:41, Antonin Houska wrote:
> Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru> wrote:
>
>> The patch implementing new opclass option is attached.
>>
>> It adds new attribute pg_opclass.opcisbitwise, which is set to true if opclass
>> equality is the same as binary equality.
>> By default it is true.
> I think the default value should be false and we should only set it to true
> for individual opclasses which do meet the bitwise equality requirement. Also
> extension authors should explicitly state that their data types are bitwise
> equal. Otherwise the existing opclasses, when created via pg_dump ->
> pg_restore, can be used by the system incorrectly.

Thank you for the feedback.

At first I implemented bitwise as default, because it is more common .
Though, I agree that it's essential to avoid false positives here.
The new version of the patch is attached. I also updated pg_dump.

A few more open questions:
1) How to handle contrib modules that create new opclasses?
Since default is 'not bitwise' it means that various operator classes
created in extensions
such as bloom, btree_gin and others, won't be able to take advantage of
various optimizations
that require the opclass to be BITWISE.

'v2-Opclass-bitwise-equality-0002' patch simply adds BITWISE keyword
where necessary.

2) Whether we should provide ALTER OPERATOR CLASS SET BITWISE syntax?

3) Current patch modifies regression test so that it checks CREATE
OPCLASS BITWISE syntax.
Is there anything else worth testing? As I see it, this patch is just
about infrastructure changes,
and more specific tests will be added by features that will implement
further optimizations.

--
Anastasia Lubennikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
v2-Opclass-bitwise-equality-0002.patch text/x-patch 27.0 KB
v2-Opclass-bitwise-equality-0001.patch text/x-patch 36.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maciek Sakrejda 2019-10-28 18:27:02 Re: JIT performance bug/regression & JIT EXPLAIN
Previous Message Tom Lane 2019-10-28 17:57:19 Re: define bool in pgtypeslib_extern.h