Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEORp-0002UK-Pf for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Sep 2019 01:56:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iEORo-0004ld-M9 for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Sep 2019 01:56:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iEORo-0004kp-9J for pgsql-hackers@lists.postgresql.org; Sun, 29 Sep 2019 01:56:28 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iEORl-00008w-Qr for pgsql-hackers@postgresql.org; Sun, 29 Sep 2019 01:56:27 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1iEORk-0005GE-JW; Sat, 28 Sep 2019 21:56:24 -0400 Date: Sat, 28 Sep 2019 21:56:24 -0400 From: Bruce Momjian To: James Coleman Cc: Alvaro Herrera , pgsql-hackers Subject: Re: [DOC] Document concurrent index builds waiting on each other Message-ID: <20190929015624.GA19872@momjian.us> References: <20190928161838.GD26853@momjian.us> <20190929012228.GA21412@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Sep 28, 2019 at 09:54:48PM -0400, James Coleman wrote: > On Sat, Sep 28, 2019 at 9:22 PM Alvaro Herrera wrote: > > > > On 2019-Sep-28, Bruce Momjian wrote: > > > > > The CREATE INDEX docs already say: > > > > > > In a concurrent index build, the index is actually entered into > > > the system catalogs in one transaction, then two table scans occur in > > > two more transactions. Before each table scan, the index build must > > > wait for existing transactions that have modified the table to terminate. > > > After the second scan, the index build must wait for any transactions > > > --> that have a snapshot (see ) predating the second > > > --> scan to terminate. Then finally the index can be marked ready for use, > > > > > > So, having multiple concurrent index scans is just a special case of > > > having to "wait for any transactions that have a snapshot", no? I am > > > not sure adding a doc mention of other index builds really is helpful. > > > > I always thought that create index concurrently was prevented from > > running concurrently in a table by the ShareUpdateExclusive lock that's > > held during the operation. > > You mean multiple CICs on a single table at the same time? Yes, that > (unfortunately) isn't possible, but I'm concerned in the patch with > the fact that CIC on table X blocks CIC on table Y. I think any open transaction will block CIC, which is my point. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +