Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 65B7464FCEA for ; Thu, 7 Aug 2008 03:09:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 29966-04 for ; Thu, 7 Aug 2008 03:09:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailserver.ttmail.com (unknown [88.255.235.9]) by postgresql.org (Postfix) with ESMTP id C946664FCC5 for ; Thu, 7 Aug 2008 03:09:45 -0300 (ADT) Received: from SMTP5 ([192.168.19.140]) by mailserver.ttmail.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 7 Aug 2008 09:09:41 +0300 Received: from alamut.mobiliz.com.tr ([213.139.194.86]) by SMTP5 with Microsoft SMTPSVC(6.0.3790.1830); Thu, 7 Aug 2008 09:09:41 +0300 Received: from (unknown [213.139.194.86]) by AVGW-TTMAIL-2.ttmail.com with smtp id 01f8_69f75dde_6447_11dd_b55e_001422175f0e; Thu, 07 Aug 2008 09:09:40 +0300 From: Volkan YAZICI To: pgsql-performance@postgresql.org Subject: Unexpectedly Long DELETE Wait Date: Thu, 07 Aug 2008 09:09:39 +0300 Message-ID: <874p5xwe3g.fsf@alamut.mobiliz.com.tr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Report: 1 Rules triggered * 0 -- RV3076 -- BODY: Version number X-OriginalArrivalTime: 07 Aug 2008 06:09:41.0075 (UTC) FILETIME=[2DE17230:01C8F854] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.1 tagged_above=0 required=5 tests=RDNS_NONE=0.1 X-Spam-Level: X-Archive-Number: 200808/26 X-Sequence-Number: 30907 Hi, Below command has been running since ~700 minutes in one of our PostgreSQL servers. DELETE FROM mugpsreglog WHERE NOT EXISTS (SELECT 1 FROM mueventlog WHERE mueventlog.eventlogid = mugpsreglog.eventlogid); Seq Scan on mugpsreglog (cost=0.00..57184031821394.73 rows=6590986 width=6) Filter: (NOT (subplan)) SubPlan -> Seq Scan on mueventlog (cost=0.00..4338048.00 rows=1 width=0) Filter: (eventlogid = $0) Here is some information about related tables: # SELECT pg_relation_size('emove.mueventlog') / pow(1024, 2); ?column? ---------- 11440 (1 row) # SELECT pg_relation_size('emove.mugpsreglog') / pow(1024, 2); ?column? ------------- 631.8046875 (1 row) And there isn't any constraints (FK/PK), triggers, indexes, etc. on any of the tables. (We're in the phase of a migration, many DELETE commands similar to above gets executed to relax constraints will be introduced.) Here are related postgresql.conf lines: shared_buffers = 512MB max_prepared_transactions = 0 work_mem = 8MB maintenance_work_mem = 512MB max_fsm_pages = 204800 max_fsm_relations = 8192 vacuum_cost_delay = 10 wal_buffers = 2MB checkpoint_segments = 128 checkpoint_timeout = 1h checkpoint_completion_target = 0.5 checkpoint_warning = 1min effective_cache_size = 5GB autovacuum = off And system hardware & software profile is: OS : Red Hat Enterprise Linux ES release 4 (Nahant Update 5) PostgreSQL: 8.3.1 Filesystem: GFS (IBM DS4700 SAN) CPU : 4 x Quad Core Intel(R) Xeon(TM) CPU 3.00GHz Memory : 8GB Does anybody have an idea what might be causing the problem? Any suggestions to improve the performance during such bulk DELETEs? Regards.