Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E979F1337990 for ; Fri, 29 Apr 2011 16:13:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 85102-03 for ; Fri, 29 Apr 2011 19:12:52 +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 B50A41337BD5 for ; Fri, 29 Apr 2011 16:12:51 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 29 Apr 2011 14:12:51 -0500 Message-Id: <4DBAC75C020000250003D06B@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Fri, 29 Apr 2011 14:12:44 -0500 From: "Kevin Grittner" To: "Wayne Conrad" , Subject: Re: 8.4.7, incorrect estimate References: <4DBB024B.5050500@databill.com> In-Reply-To: <4DBB024B.5050500@databill.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=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/419 X-Sequence-Number: 43481 Wayne Conrad wrote: > select page_number, ps_id, ps_page_id from ps_page where > ps_page_id in (select ps_page_id from documents_ps_page where > document_id in (select document_id from temp_doc_ids)) order by > ps_page_id; > [estimated rows=34398932; actual rows=5] > We tried increasing (from 100 to 1,000 and 10,000) the statistics > targets for each of the indexed columns, one at a time, and > analyzing the table/column with each change. This had no effect Ouch. Out of curiosity, what do you get with?: explain analyze select page_number, ps_id, ps_page_id from ps_page p where exists ( select * from documents_ps_page d where d.ps_page_id = p.ps_page_id and exists (select * from temp_document_ids t where t.document_id = d.document_id) ) order by ps_page_id ; -Kevin