Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1riiQz-001DfL-Sa for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2024 22:11:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1riiQy-00GXhJ-CI for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2024 22:11:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1riiQy-00GXhB-1h for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2024 22:11:20 +0000 Received: from fout5-smtp.messagingengine.com ([103.168.172.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1riiQv-003WGe-Ty for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2024 22:11:19 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 3130313800DF; Fri, 8 Mar 2024 17:11:16 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 08 Mar 2024 17:11:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1709935876; x=1710022276; bh=ZlIw0x8/Gipe/PiEBYiXkPG8kv2Rkp7oVwQ7iTC3AAE=; b= sADqqyGyhV0o6p/C83GxjxruvrW/v/HL3ToJrQ+xGP5YkskLJfSLggWoaprcrLGJ MQq81JWZGNkbEtcpdgmsWbvRmfC6fixaQUldHVXGGk6wpuzXx9egEEsLO6mora0r NQtLM9Gnbj+QbjquBfFOxbTwGEqyTPHd7iz/9im0Fauw/XjDOZLhh0bvgT6Zk3JP JrJ7PKp6Yh2NQEH5QZEqeHRr5wmWT4zMo1ZM9dUxDA3lhT6bly8UAGs1fgicxMeB y0dTBmnhS9guAdsTAQdzZTvr1c+6TLZCErprpwB1K6XuZikrvfH9jwW7vN5Ljouj reh3Pl7MXsOpzq2SZ7Tadg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709935876; x= 1710022276; bh=ZlIw0x8/Gipe/PiEBYiXkPG8kv2Rkp7oVwQ7iTC3AAE=; b=S Ce1PoFp9yLgVG8cWHD7to/sKvxFWkvUdb8xRUXQgerTmu/AIh8EnTXl4k+uOYG1J 4/h2wY1z5k4PYfudKCD+nlF61ysMnjT+5j57jacSKKsENUQTbGNfZ5GYhZZktCM3 v72CaQiDFnmhOcRmrBCZ1H6SCYjf8xt4XtnqvjuWY/rbQv00jWcTpvMDInStOSX5 jjiKLdZX0sK8Lukt8/Vtcozm12+nk4psAPJ5nENYJG48LygMa8qFrdqiCcKBwHt3 tLtfDOmwCsdudkvQP/61KYMg/O6BFS6XiBJfinkOO+wGYN4QQfBszVAOsZiUfh+v fkZTWgAE6pYtaLNItM13Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieehgdduheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtke ertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepffelgeeife fgveduhedthfekuedtffejveegffegjeevtdehgfduieetfeehjeehnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Mar 2024 17:11:15 -0500 (EST) Message-ID: <7ca9af73-6cb2-4ac0-8dfb-b83a50c64363@aklaver.com> Date: Fri, 8 Mar 2024 14:11:15 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Question related to partitioning with pg_partman Content-Language: en-US To: sud , pgsql-general References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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