Re: Re: Adding foreign key constraint holds exclusive lock for too long (on production database)
От | Ben Hoyt |
---|---|
Тема | Re: Re: Adding foreign key constraint holds exclusive lock for too long (on production database) |
Дата | |
Msg-id | CAL9jXCGwYkz1Ow-s52XZcfgeR97G+H8hLg-Rr4gwzKY+61sqow@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Re: Adding foreign key constraint holds exclusive lock for too long (on production database) (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-performance |
Hmm, weird -- now the RI_Initial_Check() query is much quicker (20s). We do ANALYZE the data every few nights, so maybe that's what changed it. I'll keep that in mind. -Ben
On Fri, Nov 1, 2013 at 3:19 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Ben Hoyt <benhoyt@gmail.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 theHuh. Maybe an optimizer failing? Could we see the full text of both
> RI_Initial_Check() query by hand, and it takes just as long as the ADD
> CONSTRAINT.
queries and EXPLAIN ANALYZE results for them?Doesn't seem unreasonable. One thought is that maybe you need to insert a
> 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?
manual ANALYZE after reloading the data?
regards, tom lane
В списке pgsql-performance по дате отправления: