Re: Performance Issue with Hash Partition Query Execution in PostgreSQL 16

From: David Mullineux <dmullx(at)gmail(dot)com>
To: Ramakrishna m <ram(dot)pgdb(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>, ravisql09(at)gmail(dot)com
Subject: Re: Performance Issue with Hash Partition Query Execution in PostgreSQL 16
Date: 2024-11-06 22:11:00
Message-ID: CAGsyd8WqPEgoAkNO0Q7rpQpOWOZ-Z6wCM7xh5d6nXCxLH_GM_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It might be worth eliminating the use of cached plans here. Is your app
using prepared statements at all?
Point is that if the optimizer sees the same prepared query , 5 times, the
it locks the plan that it found at that time. This is a good trade off as
it avoids costly planning-time for repetitive queries. But if you are
manually querying, the a custom plan will be generated anew.
A quick analyze of the table should reset the stats and invalidate any
cached plans.
This may not be your problem just worth eliminating it from the list of
potential causes.

On Wed, 6 Nov 2024, 17:14 Ramakrishna m, <ram(dot)pgdb(at)gmail(dot)com> wrote:

> Hi Team,
>
> One of the queries, which retrieves a single record from a table with 16
> hash partitions, is taking more than 10 seconds to execute. In contrast,
> when we run the same query manually, it completes within milliseconds. This
> issue is causing exhaustion of the application pools. Do we have any bugs
> in postgrs16 hash partitions? Please find the attached log, table, and
> execution plan.
>
> size of the each partitions : 300GB
> Index Size : 12GB
>
> Postgres Version : 16.x
> Shared Buffers : 75 GB
> Effective_cache : 175 GB
> Work _mem : 4MB
> Max_connections : 3000
>
> OS : Ubuntu 22.04
> Ram : 384 GB
> CPU : 64
>
> Please let us know if you need any further information or if there are
> additional details required.
>
>
> Regards,
> Ram.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Don Seiler 2024-11-07 03:41:02 Re: Index Partition Size Double of its Table Partition?
Previous Message Craig McIlwee 2024-11-06 18:47:47 Trouble using pg_rewind to undo standby promotion