Re: allow LIMIT in UPDATE and DELETE - Mailing list pgsql-general

From Csaba Nagy
Subject Re: allow LIMIT in UPDATE and DELETE
Date
Msg-id 1148045197.17461.377.camel@coppola.muc.ecircle.de
Whole thread Raw
In response to Re: allow LIMIT in UPDATE and DELETE  (Csaba Nagy <nagy@ecircle-ag.com>)
List pgsql-general
> That would spare a HashAggregate and an index scan. The index scan would
> very likely not be a problem, as the same index entries are visited in
> the subquery and likely are cached, and the HashAggregate should be also
> fast for the max 1000 rows it has to handle, but they are still
> completely unnecessary for my purpose, so I still think the LIMIT on
> DELETE and UPDATE would make perfect sense.

Oh, it just occured to me: the subquery is using a different index than
the outer loop, so we can forget about caching. Considering that the
outer loop uses an index 10x bigger than the subquery, and that means
~50million entries, and the typical situation where this would be used
mostly selects 1000 rows indeed, the LIMIT on DELETE for this case would
mean for sure ~ 50% speedup.

Cheers,
Csaba.



pgsql-general by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: allow LIMIT in UPDATE and DELETE
Next
From: Tom Lane
Date:
Subject: Re: allow LIMIT in UPDATE and DELETE