Thread: Feature request: limited deletions

Feature request: limited deletions

From
Thom Brown
Date:
I couldn't find any discussion on this, but the request is quite straightforward.  Implement a LIMIT on DELETE statements like SELECT statements.

So you could write:

DELETE FROM massive_table WHERE id < 40000000 LIMIT 10000;

This would allow deletions in smaller batches rather than waiting potentially hours for the server to mark all those rows as deleted and commit it as one massive transaction.

... although I suspect there will be reasons against this.

Thom

Re: Feature request: limited deletions

From
Ian Barwick
Date:
2010/4/8 Thom Brown <thombrown@gmail.com>:
> I couldn't find any discussion on this, but the request is quite
> straightforward.  Implement a LIMIT on DELETE statements like SELECT
> statements.
>
> So you could write:
>
> DELETE FROM massive_table WHERE id < 40000000 LIMIT 10000;
>
> This would allow deletions in smaller batches rather than waiting
> potentially hours for the server to mark all those rows as deleted and
> commit it as one massive transaction.

Is this a PgAdmin-specific question? If it is, apologies I am missing
the context.

If not, this is totally the wrong list, but why not use a subquery to
control what is deleted?


Ian Barwick

Re: Feature request: limited deletions

From
Thom Brown
Date:
On 8 April 2010 11:55, Ian Barwick <barwick@gmail.com> wrote:
2010/4/8 Thom Brown <thombrown@gmail.com>:
> I couldn't find any discussion on this, but the request is quite
> straightforward.  Implement a LIMIT on DELETE statements like SELECT
> statements.
>
> So you could write:
>
> DELETE FROM massive_table WHERE id < 40000000 LIMIT 10000;
>
> This would allow deletions in smaller batches rather than waiting
> potentially hours for the server to mark all those rows as deleted and
> commit it as one massive transaction.

Is this a PgAdmin-specific question? If it is, apologies I am missing
the context.

If not, this is totally the wrong list, but why not use a subquery to
control what is deleted?


Ian Barwick

Erm... my mistake, I thought this was on the generic hackers list.  Moving it over in this reply.

Thom