Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id A1C5B9FA511 for ; Tue, 2 Oct 2007 18:55:40 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 47963-08 for ; Tue, 2 Oct 2007 18:55:25 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by postgresql.org (Postfix) with ESMTP id C1C1D9FA4BF for ; Tue, 2 Oct 2007 18:55:31 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id j3so9074ugf for ; Tue, 02 Oct 2007 14:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=HaT+sI+ty7ugOdQ5+oJczo05u8a5C/zoSwqhLl+X+WE=; b=p0kfb9idA6TDMkhMShMZoLzhlRPn35wVvYqKAglVqEnONmtixbUd1sJ/esdx8ELKryT0brgrdcwkGbG9Tv+zS6byCMrAdyzkOAhgogH7NQkXif4Y5lu5T67YuHWEOviI2e8r65UDhL3bSrmeSGQTpZw8nlFy5JpEF894+rsGElI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=dP4p4qeC4fPUSA+Hu683KB575Cg9ie/PkeKFJvYSPVdjCVwMFw7ozjJPa1KXYfdZcmZnSRPOtV8rfXNJ0Z2vyAsPmSbPhcyq+n7/I9fgfNU6qj6KUufK8M91dNjxOqpFfRqJ1C9RrqeX5xyeAR278zNQwxt8TlgnHWDq5LA5q3U= Received: by 10.142.221.19 with SMTP id t19mr77711wfg.1191362127917; Tue, 02 Oct 2007 14:55:27 -0700 (PDT) Received: by 10.142.140.6 with HTTP; Tue, 2 Oct 2007 14:55:27 -0700 (PDT) Message-ID: Date: Tue, 2 Oct 2007 23:55:27 +0200 From: "Giulio Cesare Solaroli" To: pgsql-performance@postgresql.org Subject: Newbie question about degraded performance on delete statement. MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/8 X-Sequence-Number: 27030 Hello everybody, I have just joined the list, as I am experiencing a degradation on performances on my PostgreSQL instance, and I was looking for some insights on how to fix/avoid it. 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. Given this evidence, what are the best practices to fix/avoid this kind of problems? I am using PostgreSQL 8.1.4 both on Linux (on a Parallels virtual machine with a Linux OS) and on Solaris, on a hosted zone; the Solaris version is running the live DB, while the Linux instance is on my development machine using a snapshot of the live data. Thanks for your attention. Best regards, Giulio Cesare Solaroli