From: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
---|---|
To: | Josef Machytka <josef(dot)machytka(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: strange locks on PG 11 with Golang programs |
Date: | 2020-03-09 08:58:29 |
Message-ID: | 20200309085829.GA34056@nol |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Mar 09, 2020 at 09:51:21AM +0100, 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.
>
> 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?
The query displayed is just the query currently executing, but if the
connection is in a transaction the problematic lock could have been acquired by
any previously executed query. Did you check in pg_stat_activity if the
connection is in a transaction (e.g. query_start != xact_start)?
From | Date | Subject | |
---|---|---|---|
Next Message | Achilleas Mantzios | 2020-03-09 09:02:37 | Re: strange locks on PG 11 with Golang programs |
Previous Message | Laurenz Albe | 2020-03-09 08:57:37 | Re: Real application clustering in postgres. |