public inbox for [email protected]  
help / color / mirror / Atom feed
From: César Muñoz <[email protected]>
To: [email protected]
Subject: Memory overhead of a large number of partitions in the same table
Date: Sun, 22 Jun 2025 20:07:06 +0200
Message-ID: <CAMXZnGjLO2V+4nht7xvv04K4hE6w3DKbRZZKky1t6eYSEa9Sug@mail.gmail.com> (raw)

I would like to understand how much can partitioning can contribute to
memory usage in Postgres backend processes.

My application mainly runs SELECT statements in a partitioned table. The
table is partitioned by size (100K rows per partition, 730 partitions in
total). However, each Postgres backend process to run these SELECTs takes
~300 MB in memory, which seems a lot compared to what I've seen around.

work_mem is set to 16MB, so nothing too crazy. Also, I am using Pss to
measure the memory used by each backend process so that shared_buffers
don't mess the whole thing. Here's the output for a couple of them

Pss:             1260383 kB
Pss_Anon:         305501 kB
Pss_File:            199 kB
Pss_Shmem:        954682 kB

Pss:             1247796 kB
Pss_Anon:         293041 kB
Pss_File:            200 kB
Pss_Shmem:        954554 kB

Is this expected? Or the overhead of partitions should be smaller in terms
of memory consumption? I'm using Partman to partition the table.

Also, shared_buffers for this instance is 25GB with a total of 60GB memory.
I can provide output for explain (analyze, buffers) if needed, but the main
index used for queries is fully in memory (it takes around 18GB of space).


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], [email protected]
  Subject: Re: Memory overhead of a large number of partitions in the same table
  In-Reply-To: <CAMXZnGjLO2V+4nht7xvv04K4hE6w3DKbRZZKky1t6eYSEa9Sug@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