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 1gzIpt-000215-Oz for pgsql-general@arkaria.postgresql.org; Thu, 28 Feb 2019 10:22:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gzIps-0007Ff-EH for pgsql-general@arkaria.postgresql.org; Thu, 28 Feb 2019 10:22:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gzIps-00079h-2P for pgsql-general@lists.postgresql.org; Thu, 28 Feb 2019 10:22:40 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gzIpo-0006eQ-Rd for pgsql-general@lists.postgresql.org; Thu, 28 Feb 2019 10:22:38 +0000 Received: from [10.8.0.101] ([185.40.248.10]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MJn4B-1gjhtD1J05-00K6I3 for ; Thu, 28 Feb 2019 11:22:34 +0100 Subject: Re: Overloaded && operator from intarray module prevents index usage. To: pgsql-general@lists.postgresql.org References: <87ef7se0q3.fsf@news-spur.riddles.org.uk> From: Thomas Kellerer Message-ID: <95eb0be2-6020-3197-ecdb-8850f691ffa5@gmx.net> Date: Thu, 28 Feb 2019 11:22:33 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: <87ef7se0q3.fsf@news-spur.riddles.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-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les1fgcS1S/rSKL4egVYrc3znUUuvxKSYhcA= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andrew Gierth schrieb am 28.02.2019 um 10:29: > [intarray woes] > > Thomas> Is this expected behaviour? Is this caused by the Postgres core > Thomas> (e.g. the optimizer to taking the opclass into account) or is > Thomas> it a "problem" in the way the intarray module defines its > Thomas> operators? > > It's basically a conflict between intarray (which is historically older) > and the built-in array indexing support. > > The reason it happens is that the operator resolution logic matches an > (integer[] && integer[]) operator in preference to (anyarray && anyarray) > regardless of their relative position on the search_path. This > resolution happens before anything is known about any indexes that might > be applicable. Then later, at planning time, an index is chosen based on > the operator, not the reverse. That makes sense, thanks.