Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fijyB-0005LT-PQ for pgsql-performance@arkaria.postgresql.org; Thu, 26 Jul 2018 17:22:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fijyA-00052L-8I for pgsql-performance@arkaria.postgresql.org; Thu, 26 Jul 2018 17:22:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fijy9-00052D-TX for pgsql-performance@lists.postgresql.org; Thu, 26 Jul 2018 17:22:30 +0000 Received: from master.mhcomputing.net ([74.208.228.170] helo=mail.mhcomputing.net) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fijy6-0005EI-FG for pgsql-performance@lists.postgresql.org; Thu, 26 Jul 2018 17:22:28 +0000 Received: from [192.168.1.176] (unknown [67.207.106.10]) by mail.mhcomputing.net (Postfix) with ESMTPSA id 97E6EFA for ; Thu, 26 Jul 2018 10:22:23 -0700 (PDT) From: Matthew Hall Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: Query with "ILIKE ALL" does not use the index Date: Thu, 26 Jul 2018 10:22:21 -0700 References: <17421.1532623454@sss.pgh.pa.us> To: pgsql-performance@lists.postgresql.org In-Reply-To: <17421.1532623454@sss.pgh.pa.us> Message-Id: <460B4CB5-0D1D-43C8-829B-D7734A84779D@mhcomputing.net> X-Mailer: Apple Mail (2.3445.6.18) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Jul 26, 2018, at 9:44 AM, Tom Lane wrote: >=20 > Nicolas Even writes: >> However when I run the same (as far as I understand it) query but = with >> the ALL operator, the index is not used: >> explain analyze select name from totoz where name ilike = all(array['%tot%']); >=20 > There's only index support for "op ANY (array)", not "op ALL (array)". >=20 > regards, tom lane Nicolas, Could you work around the limitation with a two-clause WHERE? First clause ANY, second clause ALL. I've done some similar tricks on similar sorts of queries. Matthew.=