public inbox for [email protected]  
help / color / mirror / Atom feed
From: Gabriel Sánchez <[email protected]>
To: Postgres General <[email protected]>
Subject: How to query with more workers on a large table with many partitions
Date: Wed, 1 Apr 2026 10:56:20 -0400
Message-ID: <CANHuRqH7q6bi7UAmW3w+o=11Sy1pzoY5KYsLfkpjS3X3T_OQHw@mail.gmail.com> (raw)

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


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: How to query with more workers on a large table with many partitions
  In-Reply-To: <CANHuRqH7q6bi7UAmW3w+o=11Sy1pzoY5KYsLfkpjS3X3T_OQHw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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