public inbox for [email protected]  
help / color / mirror / Atom feed
How to query with more workers on a large table with many partitions
2+ messages / 2 participants
[nested] [flat]

* How to query with more workers on a large table with many partitions
@ 2026-04-01 14:56 Gabriel Sánchez <[email protected]>
  2026-04-01 15:05 ` Re: How to query with more workers on a large table with many partitions Greg Hennessy <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Gabriel Sánchez @ 2026-04-01 14:56 UTC (permalink / raw)
  To: pgsql-general

Hi PostgreSQL community,

I have a large table (86 GB) that is declaratively partitioned by year,
sub-partitioned by month, and sub-sub-partitioned by day. It currently has
437 leaf partitions, and will continue to grow with a new partition each
day. When I query a simple count(*) by date, the query planner plans a
query with five workers, but I have the following in postgresql.conf:

max_worker_processes = 12
max_parallel_workers_per_gather = 12
max_parallel_workers = 12
shared_buffers = 32GB
temp_buffers = 1GB
work_mem = 512MB

The top-level partitioned table has been ANALYZEd.

I'm running PostgreSQL 16 on an AWS EC2 instance with 16 logical processors
and 128G of RAM. How can I get PG to run the query with more workers?

Thank you,
Gabriel


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How to query with more workers on a large table with many partitions
  2026-04-01 14:56 How to query with more workers on a large table with many partitions Gabriel Sánchez <[email protected]>
@ 2026-04-01 15:05 ` Greg Hennessy <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Greg Hennessy @ 2026-04-01 15:05 UTC (permalink / raw)
  To: [email protected]


> I'm running PostgreSQL 16 on an AWS EC2 instance with 16 logical 
> processors and 128G of RAM. How can I get PG to run the query with 
> more workers?
>
Postgres allocates more workers based on the log3 of the ratio of the 
table size to min_parallel_table_scan_size.

You may want to try |ALTER TABLE ... SET (parallel_workers = 10) (or 
whatever your desired value is).

|

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-04-01 15:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-01 14:56 How to query with more workers on a large table with many partitions Gabriel Sánchez <[email protected]>
2026-04-01 15:05 ` Greg Hennessy <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox