pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Zhihong Zhang <zhihong@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: Indexing on JSONB field not working
Date: Thu, 26 Dec 2019 13:58:35 -0500
Message-ID: <4910.1577386715@sss.pgh.pa.us> (raw)
In-Reply-To: <83E6A3F7-B1B4-4AD6-905A-BE11D244D35A@gmail.com>
References: <0cf001d5b77f$bfe47e10$3fad7a30$@gmail.com>
	<20191220223005.f6w4ff4kdbgtanpz@development>
	<E3D6070E-72E0-4FE5-9E30-D114530F383F@gmail.com>
	<CAMkU=1z8X1s0WChsgKU7SN8ngrLKHt38UhAqKn-nGTf+xbQ9zg@mail.gmail.com>
	<E0F0CF2B-46DB-425C-9338-0FA59561B6B6@gmail.com>
	<CAMkU=1w8UyLY1e4N6m5nB9CmG1wjizqFS--Lmi3GZ4j1+JUP3Q@mail.gmail.com>
	<83E6A3F7-B1B4-4AD6-905A-BE11D244D35A@gmail.com>

Zhihong Zhang <zhihong@gmail.com> writes:
> The index name is correct and I ran ‘analyze' 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.

You still haven't shown us exactly what you're doing, only asserted that
you're doing the right thing, which seems somewhat unlikely given that
nobody has been able to reproduce this behavior based on what you've
told us so far.

One possible gotcha is indicated by this comment in analyze.c:

     * Open all indexes of the relation, and see if there are any analyzable
     * columns in the indexes.  We do not analyze index columns if there was
     * an explicit column list in the ANALYZE command, however.  If we are

that is, if you did something like "ANALYZE assets(_doc);" it would
not result in creation of stats for any expression indexes.

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

Wouldn't have thought that their version of Postgres deviates much
from community Postgres.  If you were talking about Aurora or Redshift,
I can't speak to what those do.

			regards, tom lane





view thread (43+ messages)  latest in thread

Message-ID: <4910.1577386715@sss.pgh.pa.us>
Permalink:  ../4910.1577386715@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4910.1577386715@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, zhihong@gmail.com, jeff.janes@gmail.com, tomas.vondra@2ndquadrant.com
  Subject: Re: Indexing on JSONB field not working
  In-Reply-To: <4910.1577386715@sss.pgh.pa.us>
  References: <0cf001d5b77f$bfe47e10$3fad7a30$@gmail.com> <20191220223005.f6w4ff4kdbgtanpz@development> <E3D6070E-72E0-4FE5-9E30-D114530F383F@gmail.com> <CAMkU=1z8X1s0WChsgKU7SN8ngrLKHt38UhAqKn-nGTf+xbQ9zg@mail.gmail.com> <E0F0CF2B-46DB-425C-9338-0FA59561B6B6@gmail.com> <CAMkU=1w8UyLY1e4N6m5nB9CmG1wjizqFS--Lmi3GZ4j1+JUP3Q@mail.gmail.com> <83E6A3F7-B1B4-4AD6-905A-BE11D244D35A@gmail.com> <4910.1577386715@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox