Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVRGt-0001zJ-Rz for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Apr 2013 18:51:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UVRGt-0005bJ-Aj for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Apr 2013 18:51:55 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVRGq-0005b7-PT; Thu, 25 Apr 2013 18:51:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVRGf-0005Mh-7w; Thu, 25 Apr 2013 18:51:52 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r3PIoLBT014979; Thu, 25 Apr 2013 14:50:21 -0400 (EDT) From: Tom Lane To: Andres Freund cc: Paul Hinze , pgsql-admin@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [ADMIN] Simultaneous index creates on different schemas cause deadlock? In-reply-to: <20130425173446.GH11158@awork2.anarazel.de> References: <10635.1366910251@sss.pgh.pa.us> <20130425173446.GH11158@awork2.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 25 Apr 2013 19:34:46 +0200" Date: Thu, 25 Apr 2013 14:50:21 -0400 Message-ID: <14978.1366915821@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) 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 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(). >> >> 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. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers