Re: About PostgreSQL Query Plan

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Eşref Halıcıoğlu <esref(dot)halicioglu(at)primeit(dot)com(dot)tr>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: About PostgreSQL Query Plan
Date: 2025-01-13 15:42:56
Message-ID: Z4U0gAcTLQ8sX29J@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jan 13, 2025 at 05:26:09PM +0300, Eşref Halıcıoğlu wrote:
> Hello,
>  
> I have a query in PostgreSQL and I want this query to retrieve only data from the last 3 months. However, when I examine the query
> plan, I see that all partitions are listed.

Please note that your explain is for update, not select (which
"retrieve" in your mail would suggest).

> This raises a few questions in my mind:
>
> • Are all partitions really being accessed, or only the partitions of the last 3 months are being accessed while the other
> partitions have to be shown in the query plan?

Not really possible to tell without reading explain *analyze*.
Potentially all. But perhaps just fewer.

Best regards,

depesz

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-01-13 16:19:11 Re: Intermittent errors when fetching cursor rows on PostgreSQL 16
Previous Message hubert depesz lubaczewski 2025-01-13 15:41:46 Re: pg_repack and locks