Re: Partitioning on the date part of a timestamp & PK issues

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
Cc: Ron <ronljohnsonjr(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Partitioning on the date part of a timestamp & PK issues
Date: 2021-07-15 22:25:21
Message-ID: 202107152225.tpa2eqvotze7@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 2021-Jul-15, Wells Oliver wrote:

> Correct me if I'm wrong, but wouldn't partitioning by just the ts column
> create a ton of partitions per the granular nature of timestamps? Or do I
> wildly misunderstand this? Another Very Large Table we have partitioned by
> a date field cleanly creates monthly partitions.

You decide the boundaries values of each partition. Dates are granular
to days, yet you have created partitions cleanly on month boundaries.
Same with timestamps. Nobody is forcing you to create one partition per
microsecond.

Anyway, I don't think what you want is possible. Your partition needs
to be formed by columns that are in the primary key, and your primary
key columns are already defined. You can partition by guid, or
partition by tid, or partition by seq, or any combination thereof. You
cannot partition by the date column. The error about expressions being
unusable is just a forerunner.

--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ron 2021-07-15 22:52:07 Re: Partitioning on the date part of a timestamp & PK issues
Previous Message Wells Oliver 2021-07-15 22:09:20 Re: Partitioning on the date part of a timestamp & PK issues