From: Adrian Klaver <adrian.klaver@aklaver.com>
To: sud <suds1434@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Question related to partitioning with pg_partman
Date: Fri, 8 Mar 2024 14:11:15 -0800
Message-ID: <7ca9af73-6cb2-4ac0-8dfb-b83a50c64363@aklaver.com> (raw)
In-Reply-To: <CAD=mzVWc=HOHrccJ20BJB5sGj_pLkaCa-7qHjV9jGAbbE3X-TQ@mail.gmail.com>
References: <CAD=mzVWc=HOHrccJ20BJB5sGj_pLkaCa-7qHjV9jGAbbE3X-TQ@mail.gmail.com>
On 3/8/24 00:23, sud wrote:
>
> Starting a new thread...
>
> Something interesting and not sure if its expected behaviour as below.
> We are also confused a bit here.
>
> In the below example we created two partitioned tables on timestamptz
> type columns with different time zones and the child partitions are
> created appropriately with boundaries as one mid night to next mid night
> of a day and so on. But when we change the time zone and query the data
> dictionary views again, it shows the start and end of the partition
> boundary as not midnights but different times of the day's values.
>
> So I was wondering if this can cause us any unforeseen issues in the
> long run while creating the partitions though partman and persisting the
> data into the tables from the end users then querying those and having
> queries properly partitioned pruned?
> or
> should we always set the local timezone as UTC always before running or
> calling the pg_partman/pg_cron process which creates the partitions?
> Mainly in a database which serves global users sitting across multiple
> timezones. And same thing while inserting data into the table, we should
> use UTC timezone conversion function. Can you please confirm.
'2024-03-07 00:00:00+00' and '2024-03-06 19:00:00-05' are the same time
as is '2024-03-07 00:00:00-05' and '2024-03-07 05:00:00+00'.
Still I would think for sanity sake you would want to stick with UTC.
>
> And while checking the timezone using the "show timezone" function it
> shows the local timezone, so is there any way to see postgres DB the
> server timezone?
show timezone is the currently set server timezone.
select reset_val from pg_settings where name = 'TimeZone';
would show you what the value would be reset to, e.g it's 'default
value. For more information do:
select * from pg_settings where name = 'TimeZone';
to see where the 'default' is set.
--
Adrian Klaver
adrian.klaver@aklaver.com
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: adrian.klaver@aklaver.com, suds1434@gmail.com
Subject: Re: Question related to partitioning with pg_partman
In-Reply-To: <7ca9af73-6cb2-4ac0-8dfb-b83a50c64363@aklaver.com>
References: <CAD=mzVWc=HOHrccJ20BJB5sGj_pLkaCa-7qHjV9jGAbbE3X-TQ@mail.gmail.com> <7ca9af73-6cb2-4ac0-8dfb-b83a50c64363@aklaver.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