Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 9D5909F9C1A for ; Tue, 2 Oct 2007 19:02:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 53767-08-2 for ; Tue, 2 Oct 2007 19:02:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from supernews.unixathome.org (supernews.unixathome.org [216.168.29.4]) by postgresql.org (Postfix) with ESMTP id CEA479F9C32 for ; Tue, 2 Oct 2007 19:02:27 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by supernews.unixathome.org (Postfix) with ESMTP id B836A17059; Tue, 2 Oct 2007 18:02:24 -0400 (EDT) X-Virus-Scanned: amavisd-new at unixathome.org Received: from supernews.unixathome.org ([127.0.0.1]) by localhost (supernews.unixathome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id COwrQTlVr9pt; Tue, 2 Oct 2007 18:02:21 -0400 (EDT) Received: from bast.unixathome.org (bast.unixathome.org [76.110.86.209]) by supernews.unixathome.org (Postfix) with ESMTP id A94D017055; Tue, 2 Oct 2007 18:02:21 -0400 (EDT) Received: from [10.55.0.99] (wocker.unixathome.org [10.55.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 3C5FCB87D; Tue, 2 Oct 2007 18:02:21 -0400 (EDT) From: "Dan Langille" To: "Giulio Cesare Solaroli" Date: Tue, 02 Oct 2007 18:02:20 -0400 MIME-Version: 1.0 Subject: Re: Newbie question about degraded performance on delete statement. CC: pgsql-performance@postgresql.org Message-ID: <470287AC.27608.6274E3F7@dan.langille.org> In-reply-to: References: X-mailer: Pegasus Mail for Windows (4.41) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/9 X-Sequence-Number: 27031 On 2 Oct 2007 at 23:55, Giulio Cesare Solaroli wrote: > What I have observed are impossibly high time on delete statements on > some tables. > > The delete statement is very simple: > delete from table where pk = ? > > The explain query report a single index scan on the primary key index, > as expected. > > I have run vacuum using the pgAdmin tool, but to no avail. > > I have also dropped and recreated the indexes, again without any benefit. > > I have later created a copy of the table using the "create table > table_copy as select * from table" syntax. > > Matching the configuration of the original table also on the copy > (indexes and constraints), I was able to delete the raws from the new > table with regular performances, from 20 to 100 times faster than > deleting from the original table. There may be more to that original table. What about triggers? rules? Perhaps there other things going on in the background. -- Dan Langille - http://www.langille.org/ Available for hire: http://www.freebsddiary.org/dan_langille.php