Re: Index tuple deduplication limitations in pg13 - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: Index tuple deduplication limitations in pg13
Date
Msg-id CAH2-Wzk67KxiOYh8-=n+HQ=ak0YyRs2fk7+MVzzbaVkS6grmag@mail.gmail.com
Whole thread Raw
In response to Index tuple deduplication limitations in pg13  (Matthias van de Meent <matthias.vandemeent@cofano.nl>)
Responses Re: Index tuple deduplication limitations in pg13  (Matthias van de Meent <matthias.vandemeent@cofano.nl>)
List pgsql-general
On Tue, Aug 18, 2020 at 11:52 AM Matthias van de Meent
<matthias.vandemeent@cofano.nl> wrote:
> Given that the above could work, the current btree tuple ordering is
> not optimized for opclass-equal but datum image-distinct values:
> ordering of opclass-equal values is currently determined only by tid,
> with as an example current ordering ['0.0', '0', '0.00', '0', '0.0',
> '0']. It would be more optimized for deduplication if that was stored
> as e.g. ['0', '0', '0', '0.0', '0.0', '0.00'], which is why I
> suggested to add an ordering by the datum image before the tid
> ordering. Additionally, this extra ordering also prevents the problem
> of [0] by never attempting an insertion of non-equal image datums in a
> posting list of otherwise equal values, as it would be ordered either
> before or after the posting list, never inside the list.

Yeah, that would work, but at the cost of making numeric totally
unusable. Now you cannot rely on unique enforcement detecting that '0'
is a duplicate of '0.0'. In fact, even the most trivial use of the =
operator will be broken in the presence of different display scales.
It's a non-starter.

The numeric2 design that I sketched is a bit ugly, but I can see no
better way. A three-way posting list split (i.e. the other design that
you sketched) is a special case that is very hard to test, very
complicated, and of little value in the grand scheme of things.

-- 
Peter Geoghegan



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Orphaned relations after crash/sigkill during CREATE TABLE
Next
From: Jason Myers
Date:
Subject: Re: Orphaned relations after crash/sigkill during CREATE TABLE