Re: Undetected Deadlock

From: Michael Harris <harmic(at)gmail(dot)com>
To: Michael Lewis <mlewis(at)entrata(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Undetected Deadlock
Date: 2022-01-27 02:54:42
Message-ID: CADofcAVRwzHnkvY9W370Qm9xiRJ0ttrvSkMK_DSx15TDyT=SVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I must be missing something. You mentioned dropping a partition, so is there an actual need for the delete? Could you detach concurrently and then drop the table or delete rows if needed?

The DELETE is part of a transaction performing data loading. Our
application allows data to be overwritten. Before using a COPY to
actually store the new data, we do a DELETE to make sure there are no
existing records. We tested a number of sequences and found that the
most efficient is to perform a DELETE first, even though in most cases
there is nothing to delete, and then do the COPY (rather than for
example checking if it exists first and then deleting it).

The DROP is part of a separate transaction that is doing the data
expiry. Note that it is not dropping the same partition; old
partitions get dropped, new data is loaded into newer partitions.

Cheers
Mike

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Lewis 2022-01-27 03:20:29 Re: Undetected Deadlock
Previous Message Bruce Momjian 2022-01-27 02:00:17 Re: PostgreSQL Management and monitoring tool