Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5F39C9F9ADF for ; Wed, 26 Sep 2007 11:45:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 26864-05 for ; Wed, 26 Sep 2007 11:45:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 541FF9F9AE7 for ; Wed, 26 Sep 2007 11:45:18 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l8QEjEOT020945; Wed, 26 Sep 2007 10:45:14 -0400 (EDT) To: pgdba cc: pgsql-performance@postgresql.org Subject: Re: Incorrect row estimates in plan? In-reply-to: <12902068.post@talk.nabble.com> References: <12902068.post@talk.nabble.com> Comments: In-reply-to pgdba message dated "Wed, 26 Sep 2007 07:22:45 -0700" Date: Wed, 26 Sep 2007 10:45:14 -0400 Message-ID: <20944.1190817914@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/446 X-Sequence-Number: 26991 pgdba writes: > -> Bitmap Heap Scan on slog (cost=82.98..6434.62 rows=2870 > width=61) (actual time=50.235..1237.948 rows=83538 loops=1) > Recheck Cond: ((gid = 10000) AND (rule = ANY > ('{1,2,8,9,10}'::integer[])) AND (CASE WHEN (rule = ANY > ('{8,9}'::integer[])) THEN destip ELSE srcip END = '192.168.10.23'::inet)) > -> Bitmap Index Scan on slog_gri_idx (cost=0.00..82.26 > rows=2870 width=0) (actual time=41.306..41.306 rows=83538 loops=1) > Index Cond: ((gid = 10000) AND (rule = ANY > ('{1,2,8,9,10}'::integer[])) AND (CASE WHEN (rule = ANY > ('{8,9}'::integer[])) THEN destip ELSE srcip END = '192.168.10.23'::inet)) [ blink... ] Pray tell, what is the definition of this index? With such a bizarre scan condition, it's unlikely you'll get any really accurate row estimate. regards, tom lane