Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTaUZ-0000or-MU for pgsql-general@arkaria.postgresql.org; Wed, 29 Apr 2020 00:22:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jTaUY-0003dj-Jr for pgsql-general@arkaria.postgresql.org; Wed, 29 Apr 2020 00:22:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTXJI-0008SN-Iy for pgsql-general@lists.postgresql.org; Tue, 28 Apr 2020 20:58:32 +0000 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jTXJE-0006CO-Rm for pgsql-general@postgresql.org; Tue, 28 Apr 2020 20:58:31 +0000 Received: by mail-qv1-xf2f.google.com with SMTP id ck5so59844qvb.11 for ; Tue, 28 Apr 2020 13:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pex-com.20150623.gappssmtp.com; s=20150623; h=from:mime-version:subject:message-id:date:to; bh=lJyTY5lP6yrz/zMHMRprDWR+Bo1PMaSvYanUhEg2vwc=; b=duqd1uPX0GQkbPiPiDDTSyQfpQPNQBfE12IK1c7EOS/mBU6+KIqFfYse9bTywZEb+m lwVFJl3JQO8ZQgteb/0zvCV1WnkSlI6JiloxGuRVdH/lfzZukTaXUAnC3ElOEpdSfEIo A9Lsou9FREiHezH0w3QqqB+WBLRfyhPkWGLZBkeucV/8YoN9CsIf9IJzDH3WbQt4cMAW UbKHiemCTqm3E5vWJ8aoAn+n02e9d16yFQIwTVmoJ2sCJxE+PP5n0AEDCgLGruGOS0nu GOFvfMhfHjuSkBAo40tWuC8OTgOBPw+9yVtCKDWZV3hKLYZRmFzmkwkGNEVN3nIMCHoV WtTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=lJyTY5lP6yrz/zMHMRprDWR+Bo1PMaSvYanUhEg2vwc=; b=LZHPVLI7DkXx/SUeDZut+MLF+ji+ejBEFhAguZsu+mQ2iCSqNhtSTo16jmj06Nj1qe h2x7+XwMyMsVrqHjC1XybXM0u4AAMxDTtImhJxlr9PeH2p8x/r+jAmxCZZnlaPXnEqud ocsjLY+zpVIVMa3x29OE94vQ1BxTx0FEPpK6tkhHu0O0iWt4M0Vi9Lh8YNzVjy6vNBbq i02Ge2jsVcgHboD18ptylTuN6yyVExQ01vifsmbU49lClA7DjszVuXn0SMmO+hf6ODsJ ulNU3ThBdtveQcGiaJ6D9ja9SZVed7to/yHB1/IREUWvfSms4aK9O8N4wWi7eg4Jfgiy OMGg== X-Gm-Message-State: AGi0Pub3rRmyH32q2vkOVDU0Rz0nqMtXDag6WDtnea8zsPG8lMNEwxxg hEqltk9Cp8J5xGM8L+gbB75khXtVvwzirRKwn1KT8aEJjRiVKG6J8KhmxDqzbwKmYMg+GoRt0lw KFZhK6UHLUjP/n3rsT/3V3dfpQnvQrAh0Top2ohb4ue6TxHwy2LeV12iYB3BJl7hjzlmORRY= X-Google-Smtp-Source: APiQypIHoMMg+LH2tnumBgaaX4ANN8I/mQOwYhiGQh78nuo89xaSOFEtpMOsmrkscqARezaDIFdlgQ== X-Received: by 2002:a05:6214:158b:: with SMTP id m11mr24480858qvw.168.1588107506963; Tue, 28 Apr 2020 13:58:26 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-248-180-229.socal.res.rr.com. [172.248.180.229]) by smtp.gmail.com with ESMTPSA id c33sm15262395qtb.76.2020.04.28.13.58.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 13:58:26 -0700 (PDT) From: Taylor Sarrafian Content-Type: multipart/alternative; boundary="Apple-Mail=_50E88F6A-4266-48F5-A854-1E2E72AC376B" Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: GIN Expression Indexes Message-Id: Date: Tue, 28 Apr 2020 13:58:23 -0700 To: pgsql-general@postgresql.org X-Mailer: Apple Mail (2.3608.40.2.2.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_50E88F6A-4266-48F5-A854-1E2E72AC376B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi friends! We tried to index an array function like this: CREATE INDEX my_arr_index ON my_table USING GIN ( my_arr_func( my_col = ) ) But the planner can=E2=80=99t seem to figure out how to use the index = with any query! It doesn=E2=80=99t work with any array operators. SELECT * FROM my_table WHERE ARRAY[ 123 ]::INT[] && my_arr_func( = my_col ) Even weirder, an empty array correctly uses the index: SELECT * FROM my_table WHERE ARRAY[]::INT[] && my_arr_func( my_col ) Is there any way to coerce Postgres into using this index? Thanks! ts= --Apple-Mail=_50E88F6A-4266-48F5-A854-1E2E72AC376B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi = friends!

We tried to = index an array function like this:

  = CREATE INDEX my_arr_index ON my_table USING GIN ( my_arr_func( my_col ) = )

But = the planner can=E2=80=99t seem to figure out how to use the index with = any query! It doesn=E2=80=99t work with any array operators.

  SELECT * FROM my_table WHERE ARRAY[ 123 ]::INT[] = && my_arr_func( my_col )

Even weirder, an empty array correctly = uses the index:

  SELECT = * FROM my_table WHERE ARRAY[]::INT[] && my_arr_func( my_col = )

Is there any way to coerce Postgres into using this index? = Thanks!

ts
= --Apple-Mail=_50E88F6A-4266-48F5-A854-1E2E72AC376B--