Re: GSoC 2017: Foreign Key Arrays

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Mark Rofail <markm(dot)rofail(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, David Steele <david(at)pgmasters(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: GSoC 2017: Foreign Key Arrays
Date: 2017-07-09 00:38:49
Message-ID: CAPpHfdt0ceOYyfHVa-kW2wN8Tb4dg+H3vVn8qAebRORw4Fsrsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 9, 2017 at 2:35 AM, Mark Rofail <markm(dot)rofail(at)gmail(dot)com> wrote:

> * What I am working on*
>
> - since we want to create an index on the referencing column, I am
> working on firing a 'CREATE INDEX' query programatically right after
> the 'CREATE TABLE' query
> - The problem I ran into is how to specify my Strategy (
> GinContainsElemStrategy) within the CREATE INDEX query. For
> example: CREATE INDEX ON fktable USING gin (fkcolumn array_ops)
> Where does the strategy number fit?
> - The patch is attached here, is the approach I took to creating an
> index programmatically, correct?
>
>
Could you, please, specify idea of what you're implementing in more
detail? AFACS, you're going to automatically create GIN indexes on FK
array columns. However, if we don't do this for regular columns, why
should we do for array columns? For me that sounds like a separate feature
which should be implemented for both regular and array FK columns.

Regarding your questions. If you need to create index supporting given
operator, you shouldn't take care about strategy number. Strategy number
makes sense only in opclass internals. You just need to specify opclass
which support your operator. In principle, you can find all of them in
pg_amop table. Alternatively you can just stick to GIN array_ops.

In general the approach you create index looks OK. It's OK to manually
create DDL node and execute it. As you can see, this is done in many other
places of backend code.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2017-07-09 07:42:32 Re: Multi column range partition table
Previous Message David Fetter 2017-07-08 23:55:41 Re: COPY vs. transition tables