Re: UniqueKey v2

From: zhihuifan1213(at)163(dot)com
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: UniqueKey v2
Date: 2023-11-07 03:44:42
Message-ID: 87cywmmdf4.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


jian he <jian(dot)universality(at)gmail(dot)com> writes:

> On Fri, Oct 20, 2023 at 4:33 PM <zhihuifan1213(at)163(dot)com> wrote:
>>
>>
>> > i did some simple tests using text data type.
>> >
>> > it works with the primary key, not with unique indexes.
>> > it does not work when the column is unique, not null.
>> >
>> > The following is my test.
>>
>> Can you simplify your test case please? I can't undertand what "doesn't
>> work" mean here and for which case. FWIW, this feature has nothing with
>> the real data, I don't think inserting any data is helpful unless I
>> missed anything.
>
> Sorry for not explaining it very well.
> "make distinct as no-op."
> my understanding: it means: if fewer rows meet the criteria "columnX <
> const_a;" , after analyze the table, it should use index only scan

No, "mark distinct as no-op" means the distinct node can be discarded
automatically since it is not needed any more. The simplest case would
be "select distinct pk from t", where it should be same as "select pk
from t". You can check the testcase for the more cases.

--
Best Regards
Andy Fan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-11-07 03:59:26 Re: Popcount optimization using AVX512
Previous Message Nathan Bossart 2023-11-07 03:35:58 Re: Atomic ops for unlogged LSN