Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A76459FA182 for ; Wed, 13 Dec 2006 17:59:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 37959-09 for ; Wed, 13 Dec 2006 17:58:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6435D9F9F49 for ; Wed, 13 Dec 2006 17:58:57 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kBDLwt15012116; Wed, 13 Dec 2006 16:58:55 -0500 (EST) To: "Tim Jones" cc: pgsql-performance@postgresql.org Subject: Re: strange query behavior In-reply-to: <47668A1334CDBF46927C1A0DFEB223D39F79FA@mail.optiosoftware.com> References: <47668A1334CDBF46927C1A0DFEB223D39F79A5@mail.optiosoftware.com> <10648.1166037392@sss.pgh.pa.us> <47668A1334CDBF46927C1A0DFEB223D39F79FA@mail.optiosoftware.com> Comments: In-reply-to "Tim Jones" message dated "Wed, 13 Dec 2006 14:44:36 -0500" Date: Wed, 13 Dec 2006 16:58:55 -0500 Message-ID: <12115.1166047135@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/342 X-Sequence-Number: 22398 "Tim Jones" writes: > The tables for theses queries are vacuumed and analyzed regularly. I > just did an analyze to be sure and here are the results > ... There's something pretty wacko about the choice of plan in the slow case --- I don't see why it'd not have used the same plan structure as for the IN case. It's coming up with a cost a lot higher than for the other, so it certainly knows this isn't a great plan ... Which PG version is this exactly? Are you running with any nondefault planner parameters? regards, tom lane