X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9746232A085 for ; Tue, 28 Sep 2004 16:04:34 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73538-03 for ; Tue, 28 Sep 2004 15:04:28 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D55C332A057 for ; Tue, 28 Sep 2004 16:04:26 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i8SF4N5o014843; Tue, 28 Sep 2004 11:04:23 -0400 (EDT) To: Robert Creager Cc: PGPerformance Subject: Re: This query is still running after 10 hours... In-reply-to: <20040928081957.7a317a95@thunder.mshome.net> References: <20040928081957.7a317a95@thunder.mshome.net> Comments: In-reply-to Robert Creager message dated "Tue, 28 Sep 2004 08:19:57 -0600" Date: Tue, 28 Sep 2004 11:04:23 -0400 Message-ID: <14842.1096383863@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/312 X-Sequence-Number: 8440 Robert Creager writes: > Normally, this query takes from 5 minutes to 2 hours to run. On this update, it's been running for more than 10 hours. > ... > -> Nested Loop (cost=250.69..129094.19 rows=77211 width=59) > -> Hash Join (cost=250.69..307.34 rows=67 width=12) > Hash Cond: ("outer".pair_id = "inner".pair_id) > ... It chose a nested loop here because it was only expecting 67 rows out of the next-lower join, and so it thought it would only need 67 repetitions of the index probe into obs_v_file_id_index. I'm suspicious that that estimate was way low and so the nestloop is taking forever. You might try "SET enable_nestloop = off" as a crude way of avoiding that trap. regards, tom lane