Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F1230632629 for ; Fri, 3 Sep 2010 12:28:27 -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 56845-09 for ; Fri, 3 Sep 2010 15:28:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx01.bfk.de (mx01.bfk.de [193.227.124.2]) by mail.postgresql.org (Postfix) with ESMTP id D4C456310AC for ; Fri, 3 Sep 2010 12:28:20 -0300 (ADT) Received: from mx00.int.bfk.de ([10.119.110.2]) by mx01.bfk.de with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) id 1OrYBf-0000pA-An; Fri, 03 Sep 2010 15:28:19 +0000 Received: by bfk.de with local id 1OrYBf-0008Gw-6W; Fri, 03 Sep 2010 15:28:19 +0000 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Odd estimation issue with user-defined type References: <82zkvyncaw.fsf@mid.bfk.de> <23120.1283526855@sss.pgh.pa.us> From: Florian Weimer Date: Fri, 03 Sep 2010 15:28:19 +0000 In-Reply-To: <23120.1283526855@sss.pgh.pa.us> (Tom Lane's message of "Fri\, 03 Sep 2010 11\:14\:15 -0400") Message-ID: <824oe6lucs.fsf@mid.bfk.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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: 201009/8 X-Sequence-Number: 40211 * Tom Lane: >> Any idea what could cause this? Do I need to provide some estimator >> function somewhere? > > If you haven't, then how would you expect the planner to know that? Perhaps it's psychic, or there is some trick I don't know about? 8-) > Less flippantly, you really need to tell us exactly what planner support > you did provide, before you can expect any intelligent comment. Has the > type got a default btree opclass? Yes, I think so (because of CREATE OPERATOR CLASS ... USING btree). > What selectivity estimators did you attach to the comparison > operators? Ah, I see, I probably need to provide a RESTRICT clause in the operator definition. That should do the trick, and should be fairly easy to implement in this case. Sorry, I just missed this piece of information in the documentation, I should have read it more carefully. --=20 Florian Weimer BFK edv-consulting GmbH http://www.bfk.de/ Kriegsstra=DFe 100 tel: +49-721-96201-1 D-76133 Karlsruhe fax: +49-721-96201-99