pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Leangen <postgres@leangen.net>
To: pgsql-performance@postgresql.org
Subject: Delete operation VERY slow...
Date: Fri, 16 Jun 2006 15:58:46 +0900
Message-ID: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> (raw)


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!





view thread (6+ messages)  latest in thread

Message-ID: <1150441126.4812.23.camel@sonoda.bioscene.co.jp>
Permalink:  ../1150441126.4812.23.camel@sonoda.bioscene.co.jp/
Also on:    postgresql.org/message-id/1150441126.4812.23.camel@sonoda.bioscene.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: postgres@leangen.net
  Subject: Re: Delete operation VERY slow...
  In-Reply-To: <1150441126.4812.23.camel@sonoda.bioscene.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox