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 1ikWT9-0003RD-14 for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2019 16:58:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikWT7-0002JT-O3 for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2019 16:58:37 +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 1ikWT7-0002Hk-Dd for pgsql-bugs@lists.postgresql.org; Thu, 26 Dec 2019 16:58:37 +0000 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ikWT0-0007Eb-W1 for pgsql-bugs@lists.postgresql.org; Thu, 26 Dec 2019 16:58:37 +0000 Received: by mail-qk1-x72a.google.com with SMTP id z76so20157348qka.2 for ; Thu, 26 Dec 2019 08:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=YU2IZ5R7Dm/XamFDNNJsxVk2MWFTLzdDw9s/PL/kNd0=; b=lOm7axaOSeQGFgse0GYzlI89yi7bRbSTQyANMCVC01A3qCbvDIAjW1Qx3juYdwTSe/ N8Ynu5ZHw8Y34tfEEc1bBU+jCFjx4vOzZnLB8/dSXDurRY8wFNV4/a2KYtPH39QXiI5v jwxeWdxTz0Lp16iWm1UADuee1BCHxDnZ64kWS1gtWnrV4lqIqGua8TU5pGs+ZVGeFM7y R4gIjLmQwWNfI5DZkmf3JJ4MsiaxGZiuqs3u4T1boWelHLjQflgUy8s0Wcg4msanglZR 0Ms8YTFR9xa8kZDzZHbl3yCh/dNAOVQrLCISn1Juz1BdrU+43IzqpmKcFfqIksTH9CK4 fHmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=YU2IZ5R7Dm/XamFDNNJsxVk2MWFTLzdDw9s/PL/kNd0=; b=X4slDk93eZhDPS1+/+CqfNrjRQlEojnq5Ghw/yAnAMtTy67wO+ZPcgP6gdSXYIHh6l 0q1az9cc6XiGwEQ1+sKNjJgs2nKzPsxVioBKyvA8s8S9aFYFgLUTGZWpn3wQ6edpqHfW 3OQyT4W9S++/uvfshqg9f+uVJZ1Ntd6FSPJfGhPHRtnAfMg6WwEEZJyNchKKWdT5Ski2 UCopxLbw7TjdgwG1yQGpIo8XJOoPBGDtxBQ1kYA8oL7JhD2ZKjxpuaf0mDNxBirAbOjO ljfxkk25UyY7XLJuLe4YZrrJQsX+7BK0TMvlQo59Sq54mFnV5+XghTszOQctYPVPNmGn Kr3A== X-Gm-Message-State: APjAAAXzuZQK6Ks3ShKNCj7AM8iZelPpSCsQk0p1TLbor5GJSnJnWaV9 OOoVm4sU+7yAYmeC4dNScZs= X-Google-Smtp-Source: APXvYqwe9qoA5BYJLxP0TRPBHW/29f6WHHQ5kXUSXlnC/s9tZb9gFgfR+ui0EmIcoVDcX4B3Q5DYpA== X-Received: by 2002:a37:ea09:: with SMTP id t9mr39527468qkj.151.1577379508861; Thu, 26 Dec 2019 08:58:28 -0800 (PST) Received: from [10.8.0.6] (pool-173-79-120-3.washdc.fios.verizon.net. [173.79.120.3]) by smtp.gmail.com with ESMTPSA id j1sm8769235qkl.86.2019.12.26.08.58.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Dec 2019 08:58:28 -0800 (PST) From: Zhihong Zhang Message-Id: <83E6A3F7-B1B4-4AD6-905A-BE11D244D35A@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_26F0F37B-7B55-49CC-9C41-C2ADD66642F3" Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: Indexing on JSONB field not working Date: Thu, 26 Dec 2019 11:58:27 -0500 In-Reply-To: Cc: Tomas Vondra , pgsql-bugs To: Jeff Janes References: <0cf001d5b77f$bfe47e10$3fad7a30$@gmail.com> <20191220223005.f6w4ff4kdbgtanpz@development> 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=_26F0F37B-7B55-49CC-9C41-C2ADD66642F3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 The index name is correct and I ran =E2=80=98analyze' multiple times = since the index is created. I have dozen indexes, some are created when = table is created. None of them is in pg_stats. The pg_stats only contains a row for each column, nothing else.=20 The database is on AWS RDS. Does that make any difference? Zhihong > On Dec 26, 2019, at 11:50 AM, Jeff Janes wrote: >=20 >> On Dec 21, 2019, at 10:17 AM, Jeff Janes > wrote: >>=20 >> Can you show the output of: >>=20 >> select * from pg_stats where tablename =3D'float_number_index_path2' >>=20 >> For readability, use the output format which shows the columns down = the screen, not across. In psql, that would toggled on with \x. >>=20 >=20 >=20 > On Thu, Dec 26, 2019 at 11:30 AM Zhihong Zhang > wrote: > That command yields nothing. >=20 > Did you use the actual name of the index (in case its actual name = differs from what you showed us in the CREATE INDEX)? If you did and it = doesn't show anything, then I don't think the table has been ANALYZED = since the index was created. Note that ANALYZE and EXPLAIN ANALYZE are = different things. You need to run "ANALYZE assets;" or "VACUUM ANALYZE = assets;" >=20 > Cheers, >=20 > Jeff --Apple-Mail=_26F0F37B-7B55-49CC-9C41-C2ADD66642F3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 The = index name is correct and I ran =E2=80=98analyze' multiple times since = the index is created. I have dozen indexes, some are created when table = is created. None of them is in pg_stats.

The pg_stats only contains a row for = each column, nothing else. 

The database is on AWS RDS. Does that = make any difference?

Zhihong


On Dec = 26, 2019, at 11:50 AM, Jeff Janes <jeff.janes@gmail.com> wrote:

On Dec = 21, 2019, at 10:17 AM, Jeff Janes <jeff.janes@gmail.com> wrote:

Can you show the output of:

select * from pg_stats where tablename = =3D'float_number_index_path2'

For readability, use the output format = which shows the columns down the screen, not across.  In psql, that = would toggled on with \x.


On Thu, Dec 26, 2019 at 11:30 AM Zhihong Zhang <zhihong@gmail.com> = wrote:
That command yields nothing. =

Did you use the actual name of the index (in case its actual = name differs from what you showed us in the CREATE INDEX)?  If you = did and it doesn't show anything, then I don't think the table has been = ANALYZED since the index was created.  Note that ANALYZE and = EXPLAIN ANALYZE are different things.  You need to run "ANALYZE = assets;" or "VACUUM ANALYZE assets;"

Cheers,

Jeff

= --Apple-Mail=_26F0F37B-7B55-49CC-9C41-C2ADD66642F3--