Re: COPY blocking \dt+?

2020-05-04 Thread David Rowley
On Tue, 5 May 2020 at 14:50, pinker  wrote:
> So it would need to run inside single transaction to cause lock, right? do
> you know if pgbench is opening transaction?

The TRUNCATE and COPY are done in the same transaction.  You can see
the code in 
https://github.com/postgres/postgres/blob/REL_11_6/src/bin/pgbench/pgbench.c#L3599

David




Re: COPY blocking \dt+?

2020-05-04 Thread pinker
thank you David.
So it would need to run inside single transaction to cause lock, right? do
you know if pgbench is opening transaction?



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html




Re: COPY blocking \dt+?

2020-05-04 Thread David Rowley
On Tue, 5 May 2020 at 13:05, pinker  wrote:
> I'm running standard pgbench and what's kinda strange copy pgbench_accounts
> from stdin is blocking my other query which is \dt+.
> Does copy hold any exclusive lock or there is something wrong with my
> system?

COPY does not. However, pgbench does TRUNCATE the tables before doing
the COPY, so that'll be most likely what's causing your query to get
blocked.

David