Fast deletes

From: Jason Hihn <jhihn(at)paytimepayroll(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Fast deletes
Date: 2003-08-14 13:28:27
Message-ID: NGBBLHANMLKMHPDGJGAPCEGECMAA.jhihn@paytimepayroll.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I'm looking for a fast way to completely clear a table that does not involve
dropping it. Essentially, I want the table to get empty quick. I can
understand why DELETE can be much slower than a drop and recreate of the
table, however none of those reasons apply here. There are no cascades on
the tables I wish to drop, and the table clearing happens w.r.t. keys. That
is to say, I clear out the leaf tables first and work up the stem, whenever
there are dependencies.

I was hoping there would be something like a truncate command that would
just rest the table blindly. Is there such a way? I don't like the drop
table idea because if the file for the schema isn't available (offline disk
or something) then I'd be fubar.

Currently, it takes several minutes (10+) to of empty one of my biggest 3
tables, and the entire time postmaster is pegged at 99.8% CPU. (90% of that
is "system").

The machine isn't using any swap memory either...
Thanks,

Jason Hihn

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-08-14 13:46:19 Re: Fast deletes
Previous Message Jason Hihn 2003-08-14 13:12:20 User/login questions