CREATE TABLE (with INHERITS) and ACCESS EXCLUSIVE locks - Mailing list pgsql-general

From Thomas F. O'Connell
Subject CREATE TABLE (with INHERITS) and ACCESS EXCLUSIVE locks
Date
Msg-id 59B141DC-FE34-4FC0-86AC-7DEBC9997706@sitening.com
Whole thread Raw
Responses Re: CREATE TABLE (with INHERITS) and ACCESS EXCLUSIVE locks  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I'm guessing that CREATE TABLE in itself doesn't take an ACCESS
EXCLUSIVE lock because there's nothing yet to lock. But can CREATE
TABLE ... INHERITS ... take an ACCESS EXCLUSIVE lock? Is it
functioning as an ALTER TABLE?

I'm dealing with an application that can potentially do ad hoc DDL.
It uses a PG/pgSQL function, and the only DDL statements in the
function are CREATE TABLE and CREATE INDEX statements. But I'm
noticing that during the backup process (with pg_dump or pg_dumpall),
the function is acquiring ACCESS EXCLUSIVE locks and bringing the
application to its knees. This seems to be a result of connections
backing up waiting for the DDL to finish, and the DDL can't finish
until the backup process finishes because of the function's ACCESS
EXCLUSIVE lock conflicting with the database-wide ACCESS SHARE locks
acquired by the backup process.

--
Thomas F. O'Connell
Database Architecture and Programming
Co-Founder
Sitening, LLC

http://www.sitening.com/
3004 B Poston Avenue
Nashville, TN 37203-1314
615-260-0005 (cell)
615-469-5150 (office)
615-469-5151 (fax)


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Create an index with a sort condition
Next
From: Tom Lane
Date:
Subject: Re: CREATE TABLE (with INHERITS) and ACCESS EXCLUSIVE locks