Re: Indexing on JSONB field not working

From: Zhihong Zhang <zhihong(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Indexing on JSONB field not working
Date: 2019-12-26 19:22:30
Message-ID: 0A83C661-EDBB-43C8-9CBB-FB1E321A15CB@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I simply ran ‘analyze;’ without table name and I assume that analyzes everything. I just ran ‘analyze assets;’ again but still no stats on indexes.

I looked at pg_stats for all our databases. None of them have stats on indexes. Are there any settings disabling this?

Thanks!

Zhihong

> On Dec 26, 2019, at 1:58 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Zhihong Zhang <zhihong(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-12-26 20:49:18 Re: Indexing on JSONB field not working
Previous Message Mahendra Singh 2019-12-26 19:03:03 Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema