pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Seamus Abshere <sabshere@alumni.princeton.edu>
To: pgsql-general@postgresql.org
Subject: Why is Postgres only using 8 cores for partitioned count?
Date: Fri, 12 Feb 2021 16:50:18 -0500
Message-ID: <19b02e4e-c2b4-4853-868e-2541965da96a@www.fastmail.com> (raw)

hi,

How can I convince Postgres to use more than 8 cores?

I've got an r6gd.16xlarge with 64 vCpus and 512gb RAM running Postgres 13.1 on Ubuntu 20.04.

CREATE TABLE tbl (
  [...]
) PARTITION BY HASH (address_key);

It has 64 partitions - e.g. FOR VALUES WITH (modulus 64, remainder 0) etc.

We're running `SELECT COUNT(*) FROM tbl`.

I've watched top and I never see more than 8 cores going 100%.

Here is my (admittedly ridiculous) postgresql.conf:

checkpoint_completion_target = 0.9
data_directory='/tank/postgresql/13/main'
default_statistics_target = 100
effective_cache_size = 381696MB
effective_io_concurrency = 200
enable_partition_pruning=on
enable_partitionwise_aggregate=on
enable_partitionwise_join=on
listen_addresses='*'
maintenance_work_mem = 2GB
max_connections = 200
max_parallel_maintenance_workers = 4
max_parallel_workers = 512
max_parallel_workers_per_gather = 512
max_wal_size = 4GB
max_worker_processes = 512
min_wal_size = 1GB
random_page_cost = 1.1
shared_buffers = 127232MB
shared_preload_libraries = 'cstore_fdw'
synchronous_commit=off
wal_buffers = 16MB
work_mem = 1628560kB

Best,
Seamus


--
Seamus Abshere, SCEA
https://faraday.ai
https://github.com/seamusabshere
https://linkedin.com/in/seamusabshere





view thread (9+ messages)  latest in thread

Message-ID: <19b02e4e-c2b4-4853-868e-2541965da96a@www.fastmail.com>
Permalink:  ../19b02e4e-c2b4-4853-868e-2541965da96a@www.fastmail.com/
Also on:    postgresql.org/message-id/19b02e4e-c2b4-4853-868e-2541965da96a@www.fastmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: sabshere@alumni.princeton.edu
  Subject: Re: Why is Postgres only using 8 cores for partitioned count?
  In-Reply-To: <19b02e4e-c2b4-4853-868e-2541965da96a@www.fastmail.com>
  References: <19b02e4e-c2b4-4853-868e-2541965da96a@www.fastmail.com>

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

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