From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: strange locks on PG 11 with Golang programs
Date: Mon, 9 Mar 2020 11:02:37 +0200
Message-ID: <fbf5ed29-9787-2b71-57f9-91fcc8766e8b@matrix.gatewaynet.com> (raw)
In-Reply-To: <CAGvVEFuDvpFfiH6ja_jvf5u-GfhoLPEom+adWESwHEXfRjKdBQ@mail.gmail.com>
References: <CAGvVEFuDvpFfiH6ja_jvf5u-GfhoLPEom+adWESwHEXfRjKdBQ@mail.gmail.com>
On 9/3/20 10:51 π.μ., Josef Machytka wrote:
>
> We are lately experiencing very strange locks on PostgreSQL 11.7 when we process ETL tasks using our programs in Go 1.13.8 using standard libraries sql and pq.
>
> ETL task has to rename tables but PostgreSQL shows that this simple operation waits for Lock on relation and select from PG wiki (https://wiki.postgresql.org/wiki/Lock_Monitoring) which should show
> blocking process shows that command "alter table .... rename to ...." is blocked by process "COPY .... to stdout" but from completely different table.
>
Fully review your programs for connection / xaction leaks. Do you use a connection pool? Make sure in the code that you close any connections that you open, even after exceptions , try to identify
idle in transaction connections from pg_stat_activity , remember to either commit or rollback non-autocommit connections (just for the sake of clarity).
> And from time to time even selects from some tables seem to by blocked by copy commands running on other tables. This is shown by the same select from PG wiki for blocking queries.
>
> All this stuff runs from golang programs. So maybe problem is not on PostgreSQL but in golang libraries?
>
> Thank you for any suggestions
>
> Josef Machytka
>
> Berlin
>
--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: achill@matrix.gatewaynet.com
Subject: Re: strange locks on PG 11 with Golang programs
In-Reply-To: <fbf5ed29-9787-2b71-57f9-91fcc8766e8b@matrix.gatewaynet.com>
References: <CAGvVEFuDvpFfiH6ja_jvf5u-GfhoLPEom+adWESwHEXfRjKdBQ@mail.gmail.com> <fbf5ed29-9787-2b71-57f9-91fcc8766e8b@matrix.gatewaynet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox