Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHZwG-0000Xl-52 for pgsql-admin@arkaria.postgresql.org; Thu, 15 Dec 2016 17:35:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cHZwF-0000TQ-L4 for pgsql-admin@arkaria.postgresql.org; Thu, 15 Dec 2016 17:35:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cHZuZ-0006PL-If for pgsql-admin@postgresql.org; Thu, 15 Dec 2016 17:33:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cHZuW-0003AM-KF for pgsql-admin@postgresql.org; Thu, 15 Dec 2016 17:33:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uBFHXb1g001879; Thu, 15 Dec 2016 12:33:37 -0500 From: Tom Lane To: xu jian cc: "pgsql-admin@postgresql.org" Subject: Re: blocking issue when create index concurrently In-reply-to: References: Comments: In-reply-to xu jian message dated "Wed, 14 Dec 2016 23:21:13 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1877.1481823217.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 15 Dec 2016 12:33:37 -0500 Message-ID: <1878.1481823217@sss.pgh.pa.us> X-Pg-Spam-Score: -5.0 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org xu jian writes: > I was trying to create 2 indexes concurrently(on different tabl= e) in same database. I didn't expect the first create index operation would= block the other one since they were running on different table. > However, it is not true. I found one creating index command was blocking = the other one. There are (IIRC) two separate points in CREATE INDEX CONCURRENTLY where it has to wait for all other transactions to exit. That would include a transaction running another CREATE INDEX (CONCURRENTLY), even if it's for a different table. I think running two at once would end in a deadlock failure, since they would likely end up waiting for each other. Usually, if you're using C.I.C., you're trying to minimize the impact on the rest of the system, so running two at once seems a bit counterproductive anyway. regards, tom lane --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin