From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ben Hoyt <benhoyt@gmail.com>
Cc: David Johnston <polobo@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Re: Adding foreign key constraint holds exclusive lock for too long (on production database)
Date: Thu, 31 Oct 2013 10:19:48 -0400
Message-ID: <22670.1383229188@sss.pgh.pa.us> (raw)
In-Reply-To: <CAL9jXCGNjjSNqhnqKQoSdWA8G=8ohaDJrpDPBUoL4=gz9mLM_w@mail.gmail.com>
References: <CAL9jXCFwKXt67+fSGq2N4NDMEadAe=DtKdUGU2gFSS0t-crFxA@mail.gmail.com>
<1383092289576-5776315.post@n5.nabble.com>
<13822.1383093005@sss.pgh.pa.us>
<CAL9jXCGNjjSNqhnqKQoSdWA8G=8ohaDJrpDPBUoL4=gz9mLM_w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
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 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
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, benhoyt@gmail.com, polobo@yahoo.com
Subject: Re: Re: Adding foreign key constraint holds exclusive lock for too long (on production database)
In-Reply-To: <22670.1383229188@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox