From: Alexander Okulovich <aokulovich@stiltsoft.com>
To: Tomek <tomekphotos@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgres 15 SELECT query doesn't use index under RLS
Date: Thu, 19 Oct 2023 11:58:30 +0200
Message-ID: <3e30e681-1694-4636-b909-036fb5de6a20@stiltsoft.com> (raw)
In-Reply-To: <CACUaW3RUoQu6i7LHUOPe3Rg28AzTc052GH-Pn1fK1+nZaukQ7A@mail.gmail.com>
References: <5c1179bb-240b-4c1c-b4b3-2a24868e44bc@stiltsoft.com>
<CAC+9yuMcVBAEP_V20mwLM3RAW=6B4x5_wLvGXGbMGjp7U1CVTA@mail.gmail.com>
<2bc518a8-0a2a-45ff-b68f-e7d6bc25a61d@stiltsoft.com>
<CACUaW3RUoQu6i7LHUOPe3Rg28AzTc052GH-Pn1fK1+nZaukQ7A@mail.gmail.com>
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
>>
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: aokulovich@stiltsoft.com, tomekphotos@gmail.com
Subject: Re: Postgres 15 SELECT query doesn't use index under RLS
In-Reply-To: <3e30e681-1694-4636-b909-036fb5de6a20@stiltsoft.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