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 1vAniz-0067r7-5e for pgsql-general@arkaria.postgresql.org; Mon, 20 Oct 2025 11:06:48 +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 1vAnhx-00GkwA-FG for pgsql-general@arkaria.postgresql.org; Mon, 20 Oct 2025 11:05:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vAnhx-00Gkvs-4a for pgsql-general@lists.postgresql.org; Mon, 20 Oct 2025 11:05:44 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vAnht-002m9B-0Y for pgsql-general@lists.postgresql.org; Mon, 20 Oct 2025 11:05:43 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 8E0371CAE7; Mon, 20 Oct 2025 13:05:38 +0200 (CEST) Date: Mon, 20 Oct 2025 13:05:38 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Convert date and time colums to datetime Message-ID: <3cq7x5ky2pn2jabsx7bg67b4c34aijnhxc5ewpgmfot73vftd5@pjlqjnh47ymt> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <3F3B9CFD-3901-4689-A38C-84CFA767D02E@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sgsm3aqdiseerqzw" Content-Disposition: inline In-Reply-To: <3F3B9CFD-3901-4689-A38C-84CFA767D02E@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --sgsm3aqdiseerqzw Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: Convert date and time colums to datetime MIME-Version: 1.0 On 2025-10-19 20:32:07 -0600, Rob Sargent wrote: > > On Oct 19, 2025, at 2:38=E2=80=AFPM, Rich Shepard wrote: > > On Sun, 19 Oct 2025, Rob Sargent wrote: > >> I think you have to ask why those values were separated in the first > >> place. For instance if they are thought of as a pair in most queries t= hen > >> an alteration might be in order. There can be a large one time cost if > >> these tables occur in a lot of separate sql calls in the business logi= c. > >=20 > > Good point. They're in the contacts table and I use them to determine w= hen > > to make another contact and if prior contacts were more productive in t= he > > morning or afternoon. >=20 > Definitely a datetime (single value) problem, imho Actually, to me that seems to be one of the few cases where splitting them makes sense. I would expect typical updates to be something like "sane time, but 6 months later" or "same day, but different time". There might also be constraints like "not before 9am". For queries there might be stuff like "who do I need to call today", or as Rich already mentioned, statistics by time of the day. There are probably relatively few queries where you need to treat date and time as a unit. hjp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --sgsm3aqdiseerqzw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmj2F3sACgkQ8g5IURL+ KF0YzQ/+Ns5vWBtrJT/to76v3HVWBu4nbNCcNHHjsxqGhYhKllzFhw21s8Q5FWBn LolMOeMyxPEXSU0VmjyaOiaP01PFS+r3XyXQyDe+04MqLJe/rzFe9OugvAkbEluu QGRdofvuuMH5I/McQb/JqV67acmJPoMd+Wxjmsevd0J94JoaFHcXmewKHD939HZl iuv90k5ajlk3JY3bcXw/iJ/vlAy3HhfHrrdcpm/Pk0TUzY4RmK7UjiKnCAYy9BkH CzO5CNLg/e82/s2JCbja7lRcl287wSBCJ+Lh9qutTUKZdHGeSWyJp1c8xMf/WiJf fJHrE1QH08q3QptFj8iuTYh34NMKTQMARPTYaeJseuGJCxxA4TUR6OWS6SWNW22/ hh2nHI0OaVca1jS+6OM5LdkdwpxrBTLiZrHnbp3NTqU0o1WMgwmu90KcOYe98HT1 AoFIoMGoxeC2/ne0K9TnkCgowMQJTz/z/dxWMUr+wvrYAXFAJy5eTYVZothF0Kwt mEhL4vaHehJM7qAasa47aEcZYDPmOScK1qPT7vkUuAssptqSW1Xrn8diSSEkNhdc trysE1JLN4MM7EOM3/c/Z397tLQMpt0R7rswJ7ccBYCHpF9L/ay/g9346gagdflC B3bInWl5MGOYbfkIAh16vKjrjVdhZmhWUjXbqSYwgoNNDUDbgSE= =o3DE -----END PGP SIGNATURE----- --sgsm3aqdiseerqzw--