public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Gambhir Singh <[email protected]>
To: [email protected]
Subject: Re: Need an idea to operate massive delete operation on big size table.
Date: Wed, 15 Jan 2025 22:02:14 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHOGQfWPQhxoyQ5GEUEFwtdXan=krr5Ue0DDPSKJGpcW9Szi4Q@mail.gmail.com>
References: <CAHOGQfWPQhxoyQ5GEUEFwtdXan=krr5Ue0DDPSKJGpcW9Szi4Q@mail.gmail.com>

On Wed, 2025-01-15 at 20:23 +0530, Gambhir Singh wrote:
> I received a request from a client to delete duplicate records from a table which is very large in size. 
> 
> Delete queries (~2 Billion) are provided via file, and we have to execute that file in DB.
> Last time it lasted for two days. I feel there must be another way to delete records in an efficient manner
> 
> This kind of activity they do every month.

I don't think there is a better way - except perhaps to create a new copy of
the table and copy the surviving rows to the new table.  Than may win if you
delete a majority of the rows.

For the future, you could consider not adding the duplicate rows rather than
deleting them.  Perhaps a constraint that prevents the duplicates can help.

Yours,
Laurenz Albe





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Need an idea to operate massive delete operation on big size table.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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