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 1gzOo5-0005qS-2X for pgsql-general@arkaria.postgresql.org; Thu, 28 Feb 2019 16:45:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gzOo3-0007Jw-P4 for pgsql-general@arkaria.postgresql.org; Thu, 28 Feb 2019 16:45:11 +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 1gzOo3-0007Jp-Gm for pgsql-general@lists.postgresql.org; Thu, 28 Feb 2019 16:45:11 +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 1gzOnn-0006Fd-PA for pgsql-general@postgresql.org; Thu, 28 Feb 2019 16:45:11 +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 x1SGioOi010518; Thu, 28 Feb 2019 11:44:50 -0500 From: Tom Lane To: Thomas Kellerer cc: pgsql-general@postgresql.org Subject: Re: Overloaded && operator from intarray module prevents index usage. In-reply-to: References: Comments: In-reply-to Thomas Kellerer message dated "Thu, 28 Feb 2019 08:47:11 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10516.1551372290.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 28 Feb 2019 11:44:50 -0500 Message-ID: <10517.1551372290@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Kellerer writes: > While testing a query on an integer array with a GIN index, I stumbled o= ver a behaviour which surprised me and which I would consider a bug - but = maybe I am wrong. = It's not a bug --- the problem is that that operator is capturing your query reference, and it's not a member of the opclass for the index you have, so no index scan for you. > The above happens even if the intarray extension is a the end of the sea= rch path, e.g. "set search_path =3D public, intarray". Yeah, because it's an exact datatype match while the core operator is anyarray && anyarray which is not. Ideally, perhaps, the extension could add its operator to the core gin-arrays opclass, but we lack any reasonable way to manage that. Something that's maybe more likely to happen is to remove that operator from the extension altogether; but that will break things for some people too, no doubt :-( regards, tom lane