Re: Simple delete query is taking too long (never ends)

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig James <cjames(at)emolecules(dot)com>, Massalin Yerzhan <yerzhik(at)gmail(dot)com>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Simple delete query is taking too long (never ends)
Date: 2015-11-13 15:51:30
Message-ID: CAOR=d=1UaNONQhojds2griR7NjhPDT4=q7TQ=QeHbrVDoJt=6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Nov 13, 2015 at 7:15 AM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Thu, Nov 12, 2015 at 4:26 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>>> On Thu, Nov 12, 2015 at 9:48 AM, Craig James <cjames(at)emolecules(dot)com> wrote:
>>>> What about a warning on creation?
>>>>
>>>> db=> create table foo(i integer primary key);
>>>> db=> create table bar(j integer primary key, i integer);
>>>> db=> alter table bar add constraint fk_bar foreign key(i) references foo(i);
>>>> WARNING: fk_bar: column bar(i) has no index, deletions on table foo may be
>>>> slow.
>>>>
>>>> It might save some fraction of these questions.
>>
>>> Maybe, but I wonder if this would cause pg_restore to bleat warnings
>>> when restoring.
>>
>> We could probably teach pg_dump to put index definitions before FKs, if it
>> doesn't already. But I'm suspicious of this sort of "training wheels"
>> warning --- we've had roughly similar messages in the past and removed
>> them because too many people complained about them.
>
> For posterity, indexes are the last step -- and I think that's a good
> way to do things. As to the broader point, I agree. Warnings should
> be reserved for things that are demonstrably dubious, and there are
> just too many situations where that doesn't apply for an unindexed
> foreign constraint. Oh well.

If they were implemented as a notice that would be different. Much
like the notice you get about index creation on PK / Unique constraint
creation. But I'm not 100% sure it's a good idea.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim Nasby 2015-11-13 21:40:42 Re: Hanging query on a fresh restart
Previous Message Merlin Moncure 2015-11-13 14:15:06 Re: Simple delete query is taking too long (never ends)