Re: Index tuple deduplication limitations in pg13

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Matthias van de Meent <matthias(dot)vandemeent(at)cofano(dot)nl>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index tuple deduplication limitations in pg13
Date: 2020-08-18 20:00:25
Message-ID: CAH2-Wzk67KxiOYh8-=n+HQ=ak0YyRs2fk7+MVzzbaVkS6grmag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 18, 2020 at 11:52 AM Matthias van de Meent
<matthias(dot)vandemeent(at)cofano(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jason Myers 2020-08-18 20:19:24 Re: Orphaned relations after crash/sigkill during CREATE TABLE
Previous Message Adrian Klaver 2020-08-18 19:49:38 Re: Orphaned relations after crash/sigkill during CREATE TABLE