Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyQJH-0006dT-3L for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Feb 2019 00:09:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gyQJF-0006CA-D0 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Feb 2019 00:09:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyQJF-0006C2-5g for pgsql-hackers@lists.postgresql.org; Tue, 26 Feb 2019 00:09:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyQJ9-0006wV-0x for pgsql-hackers@lists.postgresql.org; Tue, 26 Feb 2019 00:09:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1Q09B13011052; Mon, 25 Feb 2019 19:09:12 -0500 From: Tom Lane To: Paul Ramsey cc: PostgreSQL Hackers Subject: Re: Allowing extensions to supply operator-/function-specific info In-reply-to: References: <15193.1548028093@sss.pgh.pa.us> <6953.1548297558@sss.pgh.pa.us> <6044.1548524131@sss.pgh.pa.us> <19993.1548697885@sss.pgh.pa.us> <7671.1551135674@sss.pgh.pa.us> Comments: In-reply-to Paul Ramsey message dated "Mon, 25 Feb 2019 15:39:49 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11050.1551139751.1@sss.pgh.pa.us> Date: Mon, 25 Feb 2019 19:09:11 -0500 Message-ID: <11051.1551139751@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Paul Ramsey writes: > On Mon, Feb 25, 2019 at 3:01 PM Tom Lane wrote: >> It's whichever one the index column's opclass belongs to. Basically what >> you're trying to do here is verify whether the index will support the >> optimization you want to perform. > * If I have tbl1.geom > * and I have built two indexes on it, a btree_geometry_ops and a > gist_geometry_ops_2d, and > * and SupportRequestIndexCondition.opfamily returns me the btree family > * and I look and see, "damn there is no && operator in there" > * am I SOL, even though an appropriate index does exist? No. If there are two indexes matching your function's argument, you'll get a separate call for each index. The support function is only responsible for thinking about one index at a time and seeing if it can be used. If more than one can be used, figuring out which one is better is done by later cost comparisons. regards, tom lane