Re: blocking issue when create index concurrently

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: xu jian <jamesxu(at)outlook(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: blocking issue when create index concurrently
Date: 2016-12-15 17:33:37
Message-ID: 1878.1481823217@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

xu jian <jamesxu(at)outlook(dot)com> writes:
> I was trying to create 2 indexes concurrently(on different table) 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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message xu jian 2016-12-15 18:39:14 答复: [ADMIN] blocking issue when create index concurrently
Previous Message Payal Singh 2016-12-15 16:44:27 Re: Database corrupted - PSQL 9.3 Ubuntu Server 14.04