Re: Delete operation VERY slow...

From: "Gourish Singbal" <gourish(at)gmail(dot)com>
To: postgres(at)leangen(dot)net
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Delete operation VERY slow...
Date: 2006-06-16 07:22:49
Message-ID: 674d1f8a0606160022p1b042676gba28553bac5ab5ea@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

David,

Truncate table would be a good idea if u want to delete all the data in the
table.
You need not perform vacuum in this case since there are no dead rows
created.

~gourish

On 6/16/06, David Leangen <postgres(at)leangen(dot)net> wrote:
>
>
> Hello!
>
> I am trying to delete an entire table. There are about 41,000 rows in
> the table (based on count(*)).
>
> I am using the SQL comment: delete from table;
>
> The operation seems to take in the order of hours, rather than seconds
> or minutes.
>
> "Explain delete from table" gives me:
>
> QUERY PLAN
> ----------------------------------------------------------------
> Seq Scan on table (cost=0.00..3967.74 rows=115374 width=6)
> (1 row)
>
>
> I am using an Intel Pentium D 2.8GHz CPU. My system has about 1.2GB of
> RAM. This should be ok... my database isn't that big, I think.
>
>
> Any ideas why this takes so long and how I could speed this up?
>
> Or alternatively, is there a better way to delete all the contents from
> a table?
>
>
> Thank you!
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

--
Best,
Gourish Singbal

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2006-06-16 07:48:00 Re: SAN performance mystery
Previous Message Richard Frith-Macdonald 2006-06-16 07:17:14 Why is my (empty) partial index query slow?