From: | Alexander Okulovich <aokulovich(at)stiltsoft(dot)com> |
---|---|
To: | Tomek <tomekphotos(at)gmail(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Postgres 15 SELECT query doesn't use index under RLS |
Date: | 2023-10-19 09:58:30 |
Message-ID: | 3e30e681-1694-4636-b909-036fb5de6a20@stiltsoft.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi Tomek,
Unfortunately, I didn't dig into this. This request is recommended to
provide when describing
<https://wiki.postgresql.org/wiki/Slow_Query_Questions#Statistics:_n_distinct,_MCV,_histogram>
slow query issues, but looks like it relates to JOINs in the query,
which we don't have.
Kind regards,
Alexander
On 19.10.2023 09:43, Tomek wrote:
> Hi Alexander!
> Apart from the problem you are writing about I'd like to ask you to
> explain how you interpret counted frac_MCV - for me it has no sense at
> all to summarize most_common_freqs.
> Please rethink it and explain what was the idea of such SUM ? I
> understand that it can be some measure for ratio of NULL values but
> only in some cases when n_distinct is small.
>
> regards
>
>>
>> Statistics: n_distinct, MCV, histogram
>>
>> Useful to check statistics leading to bad join plan. SELECT
>> (SELECT sum(x) FROM unnest(most_common_freqs) x) frac_MCV,
>> tablename, attname, inherited, null_frac, n_distinct,
>> array_length(most_common_vals,1) n_mcv,
>> array_length(histogram_bounds,1) n_hist, correlation FROM
>> pg_stats WHERE attname='...' AND tablename='...' ORDER BY 1
>> DESC;
>>
>> Returns 0 rows.
>>
>>
>> Kind regards,
>>
>> Alexander
>>
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Szymański | 2023-10-23 10:33:46 | Re: GIN JSONB path index is not always used |
Previous Message | Tomek | 2023-10-19 07:43:44 | Re: Postgres 15 SELECT query doesn't use index under RLS |