X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 028D49FA5C8 for ; Fri, 16 Jun 2006 04:06:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 36647-02 for ; Fri, 16 Jun 2006 04:06:52 -0300 (ADT) X-Greylist: delayed 00:06:39.527362 by SQLgrey- Received: from bioscene.co.jp (pee5980.hyogff01.ap.so-net.ne.jp [202.238.89.128]) by postgresql.org (Postfix) with SMTP id 3F6509F9CAA for ; Fri, 16 Jun 2006 04:06:50 -0300 (ADT) Received: (qmail 6803 invoked from network); 16 Jun 2006 07:08:26 -0000 Received: from unknown (HELO eth0.sonoda) (192.168.2.5) by bioscene.co.jp with SMTP; 16 Jun 2006 07:08:26 -0000 Subject: Delete operation VERY slow... From: David Leangen Reply-To: postgres@leangen.net To: pgsql-performance@postgresql.org Content-Type: text/plain Date: Fri, 16 Jun 2006 15:58:46 +0900 Message-Id: <1150441126.4812.23.camel@sonoda.bioscene.co.jp> Mime-Version: 1.0 X-Mailer: Evolution 2.6.0 (2.6.0-1) Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/338 X-Sequence-Number: 19695 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!