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 65F355E46D1 for ; Thu, 26 Aug 2004 08:04:36 -0300 (ADT) 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 05180-01 for ; Thu, 26 Aug 2004 11:04:31 +0000 (GMT) Received: from imf20aec.mail.bellsouth.net (imf20aec.mail.bellsouth.net [205.152.59.68]) by svr1.postgresql.org (Postfix) with ESMTP id B25675E40BA for ; Thu, 26 Aug 2004 08:04:29 -0300 (ADT) Received: from djprice ([67.33.32.20]) by imf20aec.mail.bellsouth.net (InterMail vM.5.01.06.08 201-253-122-130-108-20031117) with SMTP id <20040826110432.TSSW1723.imf20aec.mail.bellsouth.net@djprice>; Thu, 26 Aug 2004 07:04:32 -0400 From: "David Price" To: "Tom Lane" , "Richard Huxton" Cc: Subject: Re: Optimizer Selecting Incorrect Index Date: Thu, 26 Aug 2004 07:05:26 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-reply-to: <2137.1093460881@sss.pgh.pa.us> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 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: 200408/358 X-Sequence-Number: 7994 Tom, your suspicions were correct - ANALYZE was not being run. I run vacuumdb via a cron script during off hours. After checking the scripts on both systems, I found that on the system that was not functioning correctly that the '-z' (analyze) command line option to vacuumdb was missing. After correcting it and re-running the script, the poorly performing SQL query takes only a few seconds as opposed to 15 minutes. Thank you for your help! - David -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Tom Lane Sent: Wednesday, August 25, 2004 3:08 PM To: Richard Huxton Cc: David Price; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Optimizer Selecting Incorrect Index Richard Huxton writes: > Things to check: > 1. postgresql.conf settings match - different costs could cause this > 2. statistics on the two columns (trn_patno,trn_old_date) - if they > differ considerably between systems that would also explain it. The different estimated row counts could only come from #2. I suspect David has forgotten to run ANALYZE on the second system. I agree that EXPLAIN VERBOSE output is not helpful... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly