Re: Large number of partitions of a table

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Large number of partitions of a table
Date: 2022-01-17 04:32:38
Message-ID: 2bdcb53c-c1a2-1813-befe-c51381836bd3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 1/16/22 8:44 PM, Victor Sudakov wrote:
> Dear Colleagues,
>
> Do you have success (or disaster) stories for having a large number of
> partitions in a table (like maybe 10000) in a production database?
>
> I've found a great article
> https://www.depesz.com/2021/01/17/are-there-limits-to-partition-counts/
> and basically it says 70000 partitions are OK but would like to hear
> more opinions especially from production experience.
>
> If a table itself has e.g. 50 indexes, partitioning it will create 10000
> extra tables and 50*10000=500000 indexes, isn't it a heavy burden on the
> system catalogs (pg_statistic etc). It may slow down ANALYZE

My experience is with range partitions on v12.

It will *speed up* ANALYZE and VACUUM, since those operations are performed
against the (smaller) child tables, not the (empty) parent table.  If the
table is partitioned chronologically and the older children never get
modified, you won't need to analyze or vacuum them at all.

> or have some other adverse effects.

Queries can easily be *much much slower* if the partition key is *not* in
the WHERE clause.

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Victor Sudakov 2022-01-17 05:17:37 Re: Large number of partitions of a table
Previous Message Tom Lane 2022-01-17 04:27:48 Re: Large number of partitions of a table