Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVRMm-0002N6-Rw for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Apr 2013 18:58:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UVRMm-000864-BT for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Apr 2013 18:58:00 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVRMl-00085v-8c; Thu, 25 Apr 2013 18:57:59 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVRMi-0005Rr-EM; Thu, 25 Apr 2013 18:57:58 +0000 Received: from [10.40.189.15] (unknown [89.204.155.15]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 3C2654E8006; Thu, 25 Apr 2013 20:57:52 +0200 (CEST) User-Agent: K-9 Mail for Android In-Reply-To: <14978.1366915821@sss.pgh.pa.us> References: <10635.1366910251@sss.pgh.pa.us> <20130425173446.GH11158@awork2.anarazel.de> <14978.1366915821@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Subject: Re: [ADMIN] Simultaneous index creates on different schemas cause deadlock? From: "anarazel@anarazel.de" Date: Thu, 25 Apr 2013 20:57:43 +0200 To: Tom Lane ,Andres Freund CC: Paul Hinze , pgsql-admin@postgresql.org, pgsql-hackers@postgresql.org Message-ID: <7a255af4-951e-4c97-b02b-00eacc3644ce@email.android.com> Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Tom Lane schrieb: >Andres Freund writes: >> On 2013-04-25 13:17:31 -0400, Tom Lane wrote: >>> Since we know that C.I.C. executes in its own transaction, and there >>> can't be more than one on the same table due to locking, it seems to >me >>> that it'd be safe to drop our own snapshot before waiting for other >>> xacts to end. That is, we could just rearrange the last few steps >in >>> DefineIndex(), taking care to save snapshot->xmin before we destroy >the >>> snapshot so that we still have that value to pass to >>> GetCurrentVirtualXIDs(). >>>=20 >>> Anybody see a flaw in that solution? > >> Except that it still will unnecessarily wait for other CICs, just not >> deadlock, I don't see a problem. We could have a PROC_IN_CIC flag or >> something so we can ignore other index creations, but I am not sure >if >> its worth the complication. > >I'm not sure it's a good idea to ignore other CICs altogether --- they >could be executing user-defined index functions that do strange things >like consult other tables. Since this seems to me to be a bit outside >the intended use-case for CIC anyway, I think it's good enough if they >just don't deadlock Fine with me, especially as nobody seems to have complained so far other th= an the OP, so it doesn't seem to be to common.=20 I don't have access to the code ATM an I wonder whether DROP CONCURRENTLY h= as a similar problem? Depends a bit on how the waiting is done... Andres ---=20 Please excuse brevity and formatting - I am writing this on my mobile phone. --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers