Re: Indexing on JSONB field not working

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Indexing on JSONB field not working
Дата
Msg-id 12042.1577393358@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Indexing on JSONB field not working  (Zhihong Zhang <zhihong@gmail.com>)
Ответы Re: Indexing on JSONB field not working  (Zhihong Zhang <zhihong@gmail.com>)
Список pgsql-bugs
Zhihong Zhang <zhihong@gmail.com> writes:
> I looked at pg_stats for all our databases. None of them have stats on indexes. Are there any settings disabling
this?

No, I don't think so.  We only collect stats on index expressions, though,
not simple columns (since those would be duplicative of the underlying
column's stats).

Hmmm ... looking at the pg_stats view, it has a filter

  WHERE NOT a.attisdropped AND
    has_column_privilege(c.oid, a.attnum, 'select'::text) AND
    (c.relrowsecurity = false OR NOT row_security_active(c.oid))

The has_column_privilege test might be getting in the way if you're
not superuser; it will probably think you have no access privileges
for the index.  I now recall somebody complaining about that before [1],
but no fix has been accepted as yet.

Having said that, though, that only accounts for you not seeing the
entries in the pg_stats view; it doesn't explain why the optimizer
doesn't see them, assuming they're actually there in pg_statistic,
which they surely should be.

As I recall, RDS doesn't give out superuser access, so it may be
hard for you to learn more about what's happening :-(

            regards, tom lane

[1] https://www.postgresql.org/message-id/flat/6369212.CF36pTLAQO%40peanuts2



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Zhihong Zhang
Дата:
Сообщение: Re: Indexing on JSONB field not working
Следующее
От: Zhihong Zhang
Дата:
Сообщение: Re: Indexing on JSONB field not working