From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | Umut TEKİN <umuttechin(at)gmail(dot)com> |
Cc: | Marc Millas <marc(dot)millas(at)mokadb(dot)com>, 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-07-02 22:06:03 |
Message-ID: | CAApHDvrAT=rzLmKZmk-EKAkm6Evp4xy+SDaf3N6enu1Ohqm+FA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 30 Jun 2023 at 00:42, Umut TEKİN <umuttechin(at)gmail(dot)com> wrote:
> @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.
I just wanted to clear up any confusion here. The above simply is not
true. If you see the filter in EXPLAIN, then the executor *is*
applying that filter.
The planner could likely work a bit harder to prove which filters are
not required for the partition, but it currently just simply does not
do that. If we could find a cheap enough way to remove those during
planning, then we probably should.
You could likely get an idea of how the surplus filter is slowing down
execution if you widen the filter to ensure it includes all possible
"ladate" values, run the query, then run the query again without the
date range filter. I would guess it'll only save you a few percent,
but I'm open to being proven wrong.
David
From | Date | Subject | |
---|---|---|---|
Next Message | Umut TEKİN | 2023-07-02 23:12:04 | Re: need explanation about an explain plan |
Previous Message | Wen Yi | 2023-07-02 11:19:41 | [Beginner Question]What's the use of ResTarget? |