From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ben Hoyt <benhoyt(at)gmail(dot)com> |
Cc: | David Johnston <polobo(at)yahoo(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Re: Adding foreign key constraint holds exclusive lock for too long (on production database) |
Date: | 2013-10-31 14:19:48 |
Message-ID: | 22670.1383229188@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Ben Hoyt <benhoyt(at)gmail(dot)com> writes:
>> It appears the possible explanations for Ben's problem are:
>> 1. For some reason this query is a lot slower than the one he came up
>> with;
> Anyway, it's definitely #1 that's happening, as I build the
> RI_Initial_Check() query by hand, and it takes just as long as the ADD
> CONSTRAINT.
Huh. Maybe an optimizer failing? Could we see the full text of both
queries and EXPLAIN ANALYZE results for them?
> So I guess this is really a side effect of the quirky way we're
> dumping and restoring only one schema, and dropping/re-adding
> constraints on deployment because of this. Is this a really strange
> thing to do -- deploying only one schema (the "static" data) and
> dropping/re-adding constraints -- or are there better practices here?
Doesn't seem unreasonable. One thought is that maybe you need to insert a
manual ANALYZE after reloading the data?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | fburgess | 2013-10-31 22:27:10 | Update Trigger latency utilizing the IS DISTINCT FROM syntax |
Previous Message | Ben Hoyt | 2013-10-31 08:01:40 | Re: Re: Adding foreign key constraint holds exclusive lock for too long (on production database) |