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 1iHa75-0006Ea-5v for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2019 21:00:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHa73-0000hj-Rd for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2019 21:00:13 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHa73-0000ha-HI for pgsql-general@lists.postgresql.org; Mon, 07 Oct 2019 21:00:13 +0000 Received: from cloudserver124499.home.pl ([188.128.182.39]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHa70-0002Xy-BR for pgsql-general@lists.postgresql.org; Mon, 07 Oct 2019 21:00:13 +0000 Received: from host-188.117.168.42.static.3s.pl (188.117.168.42) (HELO DESKTOP5IS4FKS) by serwer1372326.home.pl (188.128.182.39) with SMTP (IdeaSmtpServer 0.83.292) id 41aac367032189a4; Mon, 7 Oct 2019 23:00:08 +0200 From: =?iso-8859-2?Q?Artur_Zaj=B1c?= To: Subject: Table locking during backup Date: Mon, 7 Oct 2019 23:00:08 +0200 Message-ID: <021f01d57d52$3397e300$9ac7a900$@ang.com.pl> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0220_01D57D62.F721EB80" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdV9S3OLAUGEer5eSPS3mvtwv+CcxA== Content-Language: pl List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multipart message in MIME format. ------=_NextPart_000_0220_01D57D62.F721EB80 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Hi, =20 I cannot reproduce some scenario I found in my PostgreSQL logs. =20 I have two connections/processes: =20 Process 24755 is standard pg_backup connection with: =20 . BEGIN; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY . LOCK TABLE gm.tableabc; . COPY FROM gm.tableabc =20 Process 5969 is normal connection where I have: =20 LOG: proces 5969 still waiting for AccessExclusiveLock on relations 562888531 of database 16429 after 1000.066 ms DETAILT: Process holding the lock: 24755. Wait queue: 5969 =20 Query that is waiting (from proces 5969) is: =20 CREATE TEMP TABLE IF NOT EXISTS tableabc=20 ( Id BIGINT DEFAULT gm.top() ) INHERITS (gm.tableabc); =20 I cannot reproduce what pg_dump is doing that causes waiting on proces = 5969 (which lock is acquired and why). When pg_dump ends lock is released and proces 5969 continues. =20 I know that doing in two parallel connections: =20 BEGIN; =20 CREATE TEMP TABLE IF NOT EXISTS tableabc=20 ( Id BIGINT DEFAULT gm.top() ) INHERITS (gm.tableabc); =20 causes waiting state on second connection until the first finished, but pg_dump connection is read only.=20 =20 Could you suggest me which part of pg_dump (which query) might cause = that behaviour. =20 Artur Zaj=B1c ------=_NextPart_000_0220_01D57D62.F721EB80 Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable

Hi,

 

I cannot = reproduce some scenario =A0I found in my PostgreSQL = logs.

 

I have two connections/processes:

 

Process = 24755 is standard pg_backup connection with:

 

…

BEGIN;
SET TRANSACTION ISOLATION LEVEL REPEATABLE = READ, READ ONLY

…

LOCK TABLE = gm.tableabc;

…

COPY FROM gm.tableabc

 

Process 5969 = is normal connection where I have:

 

LOG: proces = 5969 still waiting for AccessExclusiveLock on relations 562888531 of = database 16429 after 1000.066 ms

DETAILT: Process holding the lock: 24755. Wait queue: = 5969

 

Query that is waiting (from proces 5969) = is:

 

CREATE TEMP TABLE IF NOT EXISTS tableabc =

(

Id BIGINT DEFAULT gm.top()

) INHERITS (gm.tableabc);

 

I cannot = reproduce what pg_dump is doing that causes waiting on proces 5969 = (which lock is acquired and why). When pg_dump ends lock is released and = proces 5969 continues.

 

I know that = doing in two parallel connections:

 

BEGIN;

 

CREATE TEMP = TABLE IF NOT EXISTS tableabc

(

Id BIGINT DEFAULT = gm.top()

) INHERITS = (gm.tableabc);

 

causes = =A0waiting state on second connection until the first finished, but = pg_dump connection is read only…

 

Could you = suggest me which part of pg_dump (which query) =A0might cause that = behaviour.

 

Artur Zaj=B1c

------=_NextPart_000_0220_01D57D62.F721EB80--