From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jan Wieck <jan(at)wi3ck(dot)info> |
Cc: | Kevin Grittner <kgrittn(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [COMMITTERS] pgsql: Fix an O(N^2) problem in foreign key references. |
Date: | 2015-09-18 14:47:19 |
Message-ID: | 16320.1442587639@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Jan Wieck <jan(at)wi3ck(dot)info> writes:
> Attached is a complete rework of the fix from scratch, based on Tom's
> suggestion.
> The code now maintains a double linked list as suggested, but only uses
> it to mark all currently valid entries as invalid when hashvalue == 0.
> If a specific entry is invalidated it performs a hash lookup for maximum
> efficiency in that case.
That does not work; you're ignoring the possibility of hashvalue
collisions, and for that matter not considering that the hash value
is not equal to the hash key. I don't think your code is invalidating
the right entry at all during a foreign key constraint update, and
it certainly cannot do the right thing if there's a hash value collision.
Attached is something closer to what I was envisioning; can you do
performance testing on it?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fk-cache-performance-fix-v4.patch | text/x-diff | 3.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-09-18 17:55:44 | pgsql: Fix low-probability memory leak in regex execution. |
Previous Message | Teodor Sigaev | 2015-09-18 14:26:40 | Re: [COMMITTERS] pgsql: Add pages deleted from pending list to FSM |
From | Date | Subject | |
---|---|---|---|
Next Message | Nikolay Shaplov | 2015-09-18 15:19:26 | Re: pageinspect patch, for showing tuple data |
Previous Message | Teodor Sigaev | 2015-09-18 14:29:05 | Re: tsvector work with citext |