Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C91A8632C27 for ; Fri, 12 Feb 2010 17:00:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 03804-01 for ; Fri, 12 Feb 2010 20:59:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 2E12F632563 for ; Fri, 12 Feb 2010 16:59:55 -0400 (AST) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 12 Feb 2010 14:59:53 -0600 Message-Id: <4B756CE5020000250002F27C@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Fri, 12 Feb 2010 14:59:49 -0600 From: "Kevin Grittner" To: "lionel duboeuf" Cc: Subject: Re: Almost infinite query -> Different Query Plan when changing where clause value References: <4B755913.7090004@boozter.com> <4B7519C5020000250002F242@gw.wicourts.gov> <4B75BADE.9030906@boozter.com> In-Reply-To: <4B75BADE.9030906@boozter.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.466 tagged_above=-10 required=5 tests=AWL=0.133, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/215 X-Sequence-Number: 37636 lionel duboeuf wrote: > Thanks kevin for your answer. Here is some additionnal > informations attached as files. Could you supply an EXPLAIN ANALYZE of the fast plan as an attachment, for comparison? Anyway, it looks like at least one big problem is the bad estimate on how many rows will be generated by joining to the users5_ table: > (cost=13.20..1427.83 rows=1 width=24) > (actual time=1.374..517.662 rows=122850 loops=1) If it had expected 122850 rows to qualify for that join, it probably would have picked a different plan. I just reread your original email, and I'm not sure I understand what you meant regarding VACUUM ANALYZE. If you run that right beforehand, do you still get the slow plan for user 10? -Kevin