From: Zhihong Zhang <zhihong@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
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 17:25:22 -0500
Message-ID: <F075C03D-B73B-4A59-B080-101331F8814C@gmail.com> (raw)
In-Reply-To: <12042.1577393358@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>
<0A83C661-EDBB-43C8-9CBB-FB1E321A15CB@gmail.com>
<12042.1577393358@sss.pgh.pa.us>
I am not superuser. Let me see how I can get access to the superuser on RDS.
I will get back to you.
Thanks!
Zhihong
> On Dec 26, 2019, at 3:49 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> 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
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: zhihong@gmail.com, tgl@sss.pgh.pa.us, jeff.janes@gmail.com, tomas.vondra@2ndquadrant.com
Subject: Re: Indexing on JSONB field not working
In-Reply-To: <F075C03D-B73B-4A59-B080-101331F8814C@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> <4910.1577386715@sss.pgh.pa.us> <0A83C661-EDBB-43C8-9CBB-FB1E321A15CB@gmail.com> <12042.1577393358@sss.pgh.pa.us> <F075C03D-B73B-4A59-B080-101331F8814C@gmail.com>
* 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