Re: [PROPOSAL] Covering + unique indexes.

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PROPOSAL] Covering + unique indexes.
Date: 2015-09-15 09:18:56
Message-ID: CAKJS1f_ApKpHn2B8YHQFx6mKBLadcC0+UFoeCiLetE-W+3A3_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12 September 2015 at 00:45, Anastasia Lubennikova <
a(dot)lubennikova(at)postgrespro(dot)ru> wrote:

> I've started work on a patch that allows to combine covering and unique
> functionality.
>

Great to hear someone is working on this!

> Next issue is pg_index changes.
> Now there's only a boolean flag
>
> - bool indisunique; /* is this a unique index? */
>
> But new algorithm requires to store a single number
>
> - unit16 n_unique_columns; /* number of first columns of index which
> has unique constrains. */
>
> I think, that numbers of all attributes themselves are not needed. Is it
> right?
>
>
I think the total number of attributes is already in indnatts.
I imagine you're planning to keep the indexed columns at the start of
the indkey[] array, and just use n_unique_columns to mark how many of the
indkey[] attributes to check as indexed columns. I'd imagine the change
would be fairly simple from a planner point of view as you'd just need to
check columns 1 to n_unique_columns instead of 1 to indnatts. Although I
have a tendency to under estimate these things :(

I imagine you don't want to name the new column n_unique_columns, since it
does not fit too well with non-unique indexes.
Perhaps just indindexedatts, or something slightly along those lines. But
perhaps it would be a good idea to also rename "ncolumns" in code, to
ensure that any non-updated code does not even compile. Perhaps including
"tot" or "total" in there might help indicate it's new meaning.

Regards

David Rowley
--
David Rowley http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2015-09-15 09:24:03 Re: Summary of plans to avoid the annoyance of Freezing
Previous Message Vik Fearing 2015-09-15 09:11:07 Re: [PROPOSAL] Covering + unique indexes.