Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1B332B5DC09 for ; Wed, 21 Sep 2011 21:48:16 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 38891-06 for ; Thu, 22 Sep 2011 00:48:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D81F0B5DC01 for ; Wed, 21 Sep 2011 21:48:07 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p8M0m3qE005459; Wed, 21 Sep 2011 20:48:04 -0400 (EDT) To: Josh Berkus cc: pgsql-bugs@postgresql.org Subject: Re: Broken selectivity with special inet operators In-reply-to: <4E7A833B.1010609@agliodbs.com> References: <4E7A4923.1020900@agliodbs.com> <29153.1316638577@sss.pgh.pa.us> <4E7A547C.40700@agliodbs.com> <629.1316642270@sss.pgh.pa.us> <4E7A833B.1010609@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Wed, 21 Sep 2011 17:37:15 -0700" Date: Wed, 21 Sep 2011 20:48:03 -0400 Message-ID: <5458.1316652483@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/150 X-Sequence-Number: 31167 Josh Berkus writes: >> If you mean the indexscan optimization, we do know how to estimate the >> cost of the indexscans, because that depends mostly on the behavior of >> the added < or > condition(s). This does not imply knowing how to >> estimate the behavior of >>= itself. > If we can estimate the cost of the indexscan, why can't we estimate the > rowcount? Because the estimated rowcount is derived long before we consider whether to use an indexscan at all, and indeed must be computable whether the table has any related index or not. The special-indexscan-qual code is *not* a substitute for providing a selectivity estimator. It's possible that we could build simple estimators for these operators that just turn the problem into a range estimation and then pass it off to somewhere else, but nobody has tried. regards, tom lane