Re: Chunk Delete

From: "Alexander Staubo" <alex(at)purefiction(dot)net>
To: "Abraham, Danny" <danny_abraham(at)bmc(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Chunk Delete
Date: 2007-11-15 13:46:09
Message-ID: 88daf38c0711150546r11ca2e5exce6dbead5dacdcbc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/15/07, Abraham, Danny <danny_abraham(at)bmc(dot)com> wrote:
> With Oracle we do it with: delete ,tname> where <cond> and rownum < Y;

You could create a temporary sequence:

create temporary sequence foo_seq;
delete from foos where nextval('foo_seq') < 50000;

I'm not sure how fast nextval() is, even on temporary sequences; but
it should be reasonably fast.

If it's a FIFO queue, the table surely has some explicit order through
a column which you will need as part of the query?

Alexander.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2007-11-15 14:02:13 Re: Enforcing Join condition
Previous Message Abraham, Danny 2007-11-15 13:34:06 Chunk Delete