Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6AAC0632D1B for ; Mon, 15 Feb 2010 10:19:37 -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 03562-02 for ; Mon, 15 Feb 2010 14:19:18 +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 93FD463256D for ; Mon, 15 Feb 2010 10:19:26 -0400 (AST) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Mon, 15 Feb 2010 08:19:24 -0600 Message-Id: <4B790387020000250002F2CF@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Mon, 15 Feb 2010 08:19:19 -0600 From: "Kevin Grittner" To: , Subject: Re: Almost infinite query -> Different Query Plan when changing where clause value Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit 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/236 X-Sequence-Number: 37657 lionel duboeuf wrote: > Kevin Grittner a écrit : >> 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? > I confirm by executing manual "VACUUM ANALYZE" that the problem is > solved. But what i don't understand is that i would expect > autovacuum to do the job. I think this is the crux of the issue. Boosting the default_statistics_target or the statistics target for specific columns might help, reducing autovacuum_analyze_scale_factor might help, but I can't help wondering whether you inserted a large number of rows for user 10 and then ran the query to select user 10 before autovacuum had time to complete. Does that seem possible? -Kevin