Re: need explanation about an explain plan

From: Umut TEKİN <umuttechin(at)gmail(dot)com>
To: Marc Millas <marc(dot)millas(at)mokadb(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: need explanation about an explain plan
Date: 2023-06-29 12:42:25
Message-ID: CAPZcZRmbyL28FztKBC5Yco6co9Z=EskKb3M+St+Wh7rh6vJOGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

@Marc, I think there is no problem.Even though it says it is filtered by
ladate, it is not. Because of the partition.
As you can see for each index scan it uses a different partition and those
partition boundaries are already specified logically.
For example; "Parallel Index Scan using table1_p_201802_numfic_idx on
table1_p_201802 t_3".
If the names correctly matches the partition concept, the partition
table1_p_201802 only contains values for between 2018.02.01 and 2018.03.01.
So, even though there is a filter, there is not. Thus, filtering only
occurs for your numfic column.

The following link might help to understand how it does reading and
skipping. In your case, it does not do any harm, but maybe it would be
better change how it looks on the execution plan to prevent confusion.

https://www.postgresql.org/docs/current/indexes-multicolumn.html#:~:text=For%20example%2C%20given,be%20scanned%20through
.

Thanks!

On Thu, Jun 29, 2023 at 12:08 PM Marc Millas <marc(dot)millas(at)mokadb(dot)com> wrote:

>
>
> Le mer. 28 juin 2023 à 22:46, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> a
> écrit :
>
>> On Wed, 2023-06-28 at 19:25 +0200, Marc Millas wrote:
>> > Hi Laurenz, as said, in each partition there is only one value for
>> ladate.
>>
>> The planner doesn't seem to take that into account.
>>
> Indeed. I did check values in pg_statistic. And rerun analyze. No
> change...
>
>>
>> Yours,
>> Laurenz Albe
>>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message pf 2023-06-30 02:42:00 psql and pgpass.conf on Windows
Previous Message jian he 2023-06-29 12:38:44 Re: analyze partition