Re: Allow DELETE to use ORDER BY and LIMIT/OFFSET - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Allow DELETE to use ORDER BY and LIMIT/OFFSET
Date
Msg-id CAKFQuwZKMMXE+o7RG_XsPXgexk-R1QL19K8+t+pKnJK5+m40ig@mail.gmail.com
Whole thread Raw
In response to Allow DELETE to use ORDER BY and LIMIT/OFFSET  (Yugo NAGATA <nagata@sraoss.co.jp>)
Responses Re: Allow DELETE to use ORDER BY and LIMIT/OFFSET  (Yugo NAGATA <nagata@sraoss.co.jp>)
List pgsql-hackers
On Thursday, December 16, 2021, Yugo NAGATA <nagata@sraoss.co.jp> wrote:

Also, here seem to be some use cases. For example,
- when you want to delete the specified number of rows from a table
  that doesn't have a primary key and contains tuple duplicated.

Not our problem…use the tools correctly; there is always the hack work-around for the few who didn’t.
 
- when you want to delete the bottom 10 items with bad scores
  (without using rank() window function).

This one doesn’t make sense to me.

- when you want to delete only some of rows because it takes time
  to delete all of them.


This seems potentially compelling though I’d be more concerned about the memory aspects than simply taking a long amount of time.  If this is a problem then maybe discuss it without having a solution-in-hand?  But given the intense I/O cost that would happen spreading this out over time seems acceptable and it should be an infrequent thing to do.  Expecting users to plan and execute some custom code for their specific need seems reasonable.

So even if Tom’s technical concerns aren’t enough working on this based upon these uses cases doesn’t seem of high enough benefit.

David J.

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Add sub-transaction overflow status in pg_stat_activity
Next
From: Tom Lane
Date:
Subject: Re: WIP: WAL prefetch (another approach)