Re: INSERTS waiting with wait_event is "transactionid"

From: Nagaraj Raj <nagaraj(dot)sf(at)yahoo(dot)com>
To: Psql-performance <pgsql-performance(at)postgresql(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Subject: Re: INSERTS waiting with wait_event is "transactionid"
Date: 2021-04-09 18:22:17
Message-ID: 370926585.369065.1617992537679@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi Laurenz, Thanks for the response. 
Yeah understand that, but I'm trying to figure out why it is taking too long. there is foreign key relation to this table. 

Thanks,Rj On Friday, April 9, 2021, 02:16:08 AM PDT, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:

On Thu, 2021-04-08 at 20:14 +0000, Nagaraj Raj wrote:
> We are trying to load data around 1Bil records into one table with INSERT statements
>  (not able to use COPY command) and they are been waiting for a lock and the wait_event
>  is "transactionid", I didn't find any information in the documents. Queries have been
>  waiting for hours.

That means that your statement is stuck behind a row lock.

Row locks are stored on the table row itself and contain the transaction ID.
So the process has to wait until the transaction goes away, which is implemented
as waiting for a lock on the transaction ID.

There must be a long running transaction that locks a row that is needed for
the INSERT.  It could be a row in a different table that is referenced by a
foreign key.

Make that long running transaction go away.  Transactions should never last that long.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Pavel Stehule 2021-04-10 06:58:41 Re: proposal: schema variables
Previous Message Bruce Momjian 2021-04-09 11:39:28 Re: [PATCH] force_parallel_mode and GUC categories