Re: Allow DELETE to use ORDER BY and LIMIT/OFFSET

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow DELETE to use ORDER BY and LIMIT/OFFSET
Date: 2021-12-17 03:56:59
Message-ID: CAKFQuwZKMMXE+o7RG_XsPXgexk-R1QL19K8+t+pKnJK5+m40ig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thursday, December 16, 2021, Yugo NAGATA <nagata(at)sraoss(dot)co(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-12-17 04:02:32 Re: Add sub-transaction overflow status in pg_stat_activity
Previous Message Dilip Kumar 2021-12-17 03:31:14 Re: Add sub-transaction overflow status in pg_stat_activity