Re: GSoC 2017: Foreign Key Arrays

From: Mark Rofail <markm(dot)rofail(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Erik Rijkers <er(at)xs4all(dot)nl>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, David Steele <david(at)pgmasters(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers-owner(at)postgresql(dot)org
Subject: Re: GSoC 2017: Foreign Key Arrays
Date: 2017-08-21 13:43:12
Message-ID: CAJvoCusMuLnYZUbwTBKt+p6bB9GwiTqF95OsQFHXixJj3LkxVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Okay... There are several developments...

1) Whenever there was an index on the Foreign Key Array column and I issue
the following query "SELECT * FROM FKTABLEFORARRAY WHERE ftest1 @>> 5;" I
wouldn't get any results, even though it works without an index.
This confirmed my suspicion that there was something wrong with the GIN
index, the results were too good to be true in the comparison here
<https://www.postgresql.org/message-id/CAJvoCuv6ufngfZBPNq4icCy%3Dx6NpqVVyyPaio97ZHcZVvAC%2BZg%40mail.gmail.com>.
It's almost O(1);

Turns out the index search wasn't performed at all. When I fixed this bug,
the performance changed. And the new benchmark graph is attached below.

2) About coercion, coercion should only be allowed one way not the other.
Since casting the FK column defeats the index and performance drops
drastically. I don't want to disallow it though. Should I leave it up to
the user?

3) As of patch v4.4 DELETE CASCADE is now supported. The rest of the
actions, however, will require array manipulation.

Once the updates are confirmed, I'll update the limitation checklist.

Best Regards,
Mark Rofail

Attachment Content-Type Size
FK Benchmark2.jpg image/jpeg 454.0 KB
Array-ELEMENT-foreign-key-v4.4.patch text/x-patch 138.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-08-21 13:44:00 Re: shm_mq_wait_internal gets stuck forever on fast shutdown
Previous Message Arthur Zakirov 2017-08-21 12:59:29 Re: [PROPOSAL] Text search configuration extension