agora inbox for pgsql-admin@postgresql.org  
help / color / mirror / Atom feed
Truncate  DUMMY_mid is blocked DELETE DUMMY_init TABLE
4+ messages / 3 participants
[nested] [flat]

* Truncate  DUMMY_mid is blocked DELETE DUMMY_init TABLE
@ 2024-06-05 21:23  M Sarwar <sarwarmd02@outlook.com>
  0 siblings, 2 replies; 4+ messages in thread

From: M Sarwar @ 2024-06-05 21:23 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

Hello,
Today I have an interesting observation.
I am truncating the table DUMMY_mid .
Truncate is getting struck due to DELETE operation on the table DUMMY_init.

When I take a look at the PG_STAT_ACTIVITY table, it is confirmed that the TRUNCATE is blocked by  DELETE on DUMMY_INIT table.
This seems to be strange to me.
Thanks,
Sarwar

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Truncate DUMMY_mid is blocked DELETE DUMMY_init TABLE
@ 2024-06-05 21:39  Tom Lane <tgl@sss.pgh.pa.us>
  parent: M Sarwar <sarwarmd02@outlook.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Tom Lane @ 2024-06-05 21:39 UTC (permalink / raw)
  To: M Sarwar <sarwarmd02@outlook.com>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

M Sarwar <sarwarmd02@outlook.com> writes:
> I am truncating the table DUMMY_mid .
> Truncate is getting struck due to DELETE operation on the table DUMMY_init.

Maybe you have foreign keys connecting those tables?

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Truncate DUMMY_mid is blocked DELETE DUMMY_init TABLE
@ 2024-06-05 22:21  M Sarwar <sarwarmd02@outlook.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: M Sarwar @ 2024-06-05 22:21 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

Hi Tom,
I checked both the tables, DUMMY_MID as well as DUMMY_INIT and they do not have relationship at all.
These 2 tables number of columns and the column names are the same. The data is copied from one another. That should not matter as long as there is no foreign key relationship to each others.
Thanks,
Sarwar

________________________________
From: Tom Lane <tgl@sss.pgh.pa.us>
Sent: Wednesday, June 5, 2024 5:39 PM
To: M Sarwar <sarwarmd02@outlook.com>
Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Truncate DUMMY_mid is blocked DELETE DUMMY_init TABLE

M Sarwar <sarwarmd02@outlook.com> writes:
> I am truncating the table DUMMY_mid .
> Truncate is getting struck due to DELETE operation on the table DUMMY_init.

Maybe you have foreign keys connecting those tables?

                        regards, tom lane

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Truncate  DUMMY_mid is blocked DELETE DUMMY_init TABLE
@ 2024-06-06 07:58  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: M Sarwar <sarwarmd02@outlook.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Laurenz Albe @ 2024-06-06 07:58 UTC (permalink / raw)
  To: M Sarwar <sarwarmd02@outlook.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

On Wed, 2024-06-05 at 21:23 +0000, M Sarwar wrote:
> Today I have an interesting observation.
> I am truncating the table DUMMY_mid .
> Truncate is getting struck due to DELETE operation on the table DUMMY_init.
> 
> 
> When I take a look at the PG_STAT_ACTIVITY table, it is confirmed that
> the TRUNCATE is blocked by  DELETE on DUMMY_INIT table.
> This seems to be strange to me.

In "pg_stat_activity", you only see the last SQL statement that was executed
on that connection.  There might have been other SQL statements earlier in the
same transaction that read or in some other way used "DUMMY_mid".

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2024-06-06 07:58 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05 21:23 Truncate  DUMMY_mid is blocked DELETE DUMMY_init TABLE M Sarwar <sarwarmd02@outlook.com>
2024-06-05 21:39 ` Re: Truncate DUMMY_mid is blocked DELETE DUMMY_init TABLE Tom Lane <tgl@sss.pgh.pa.us>
2024-06-05 22:21   ` Re: Truncate DUMMY_mid is blocked DELETE DUMMY_init TABLE M Sarwar <sarwarmd02@outlook.com>
2024-06-06 07:58 ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox