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-WzkZkSC7G+v1WwXGo0emh8E-rByw=xSpBUoavk7PTjwF2Q@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
Re: Index tuple deduplication limitations in pg13
List pgsql-general
On Mon, Aug 17, 2020 at 11:44 PM Matthias van de Meent
<matthias.vandemeent@cofano.nl> wrote:
> But, if the ordering of operator-class equal tuples is already
> system-defined, could the physical ordering of index tuples in a btree
> (with deduplication enabled for "unsafe" opclasses) be updated from
> [index_columns, tid] to [index_columns,
> image_compare(non_datum_equal_columns), tid], giving a stable sorting
> of opclass-equal and image-equal values and enabling safe consistent
> deduplication?

The issue isn't the physical ordering. The issue is that we cannot
allow the implementation to destroy semantic differences among equal
datums. We avoid deduplication with cases where two equal datums are
visibly different. For example, it would not be okay if we forgot that
your numeric datum was originally input as '5.000', and output '5'
later on.

If we wanted to fix this for numeric, we'd have to invent a new
numeric datatype (called numeric2, say). That probably isn't as hard
as it sounds, since it could be part of the same B-Tree operator
family as numeric. It could also be implicitly cast to numeric.

-- 
Peter Geoghegan



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: import XML
Next
From: Peter Geoghegan
Date:
Subject: Re: Index tuple deduplication limitations in pg13