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 1gzSRw-0002Ci-BQ for pgsql-general@arkaria.postgresql.org; Thu, 28 Feb 2019 20:38:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gzSRu-0002gR-Rn for pgsql-general@arkaria.postgresql.org; Thu, 28 Feb 2019 20:38:34 +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 1gzSRu-0002gK-JO for pgsql-general@lists.postgresql.org; Thu, 28 Feb 2019 20:38:34 +0000 Received: from mail-out.m-online.net ([212.18.0.10]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gzSRc-0005WM-Js for pgsql-general@lists.postgresql.org; Thu, 28 Feb 2019 20:38:34 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 449PWq4f78z1qxJW for ; Thu, 28 Feb 2019 21:38:14 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 449PWp6y2Rz1qsFh for ; Thu, 28 Feb 2019 21:38:14 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id Xw-RLQdj8mEf for ; Thu, 28 Feb 2019 21:38:14 +0100 (CET) Received: from [192.168.178.37] (ppp-93-104-92-177.dynamic.mnet-online.de [93.104.92.177]) by mail.mnet-online.de (Postfix) with ESMTP for ; Thu, 28 Feb 2019 21:38:14 +0100 (CET) Subject: Re: Overloaded && operator from intarray module prevents index usage. To: pgsql-general@lists.postgresql.org References: <10517.1551372290@sss.pgh.pa.us> From: Thomas Kellerer Message-ID: <0adbbf65-d596-bb45-b58a-95e08517c699@gmx.net> Date: Thu, 28 Feb 2019 21:38:14 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Lewis schrieb am 28.02.2019 um 21:23: > Yeah, because it's an exact datatype match while the core operator > is anyarray && anyarray which is not. > > > Can you dumb down how to change the index or column type such that an > index will be used for the && operator while intarray extension is > installed? We have the intarray extension installed and I doubt that > I can get it removed. I've added gin index on a column declared as > type "integer array" and had expected the index to be used, but I did > not test it yet since there is some bad data with NULLs stored as a > value in the integer array and I am waiting on that data cleanup to > be done before directly using && operator. I expect that when I do > test it, I will be impacted by this same concern. It is simplest to > change the column type from integer array to anyarray? Is there a con > to doing so? I see two options: create the gin index with the opclass provided by intarray: create index ... using gin (... gin__int_ops); Or if you use the regular opclass for the GIN index, make sure to use the built-in operator, e.g.: OPERATOR(pg_catalog.&&) instead of && or OPERATOR(pg_catalog.@>) instead of @> Thomas