Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSySq-0001J3-J8 for pgsql-general@arkaria.postgresql.org; Wed, 22 Sep 2021 09:22:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mSySp-0007U4-9s for pgsql-general@arkaria.postgresql.org; Wed, 22 Sep 2021 09:22:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSySo-0007Tw-Rj for pgsql-general@lists.postgresql.org; Wed, 22 Sep 2021 09:22:50 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mSySm-0000ng-VR for pgsql-general@lists.postgresql.org; Wed, 22 Sep 2021 09:22:49 +0000 Received: by mail-pg1-x52e.google.com with SMTP id m21so1980239pgu.13 for ; Wed, 22 Sep 2021 02:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=d1shtGpCRPpbkzCh0O6KuRofHNofaisXbVt5pckFwoU=; b=jssINIvNWggtJXBY8TK9aCbJG6wE/vKqzP6/ic/VXkfPDRU6cLyRQy5eDAXtqigP9c i5Yxc0F+2eCY9s120Ko4KjNNu+s10gk3orMS7giQK+hjg2EkI73vdRIPq6oBnBzAn9uV 8m6Xv+HD2Poc0c8YNUJYOjDLWmdFduGouD4Ng23aR+vJ5/y7T3Irw8iEWO5fBylmDYrI 3fPFir/VCusKaAqr7FkClYvOuudK6EFCsO1O08ptBbAlPh83KmIKun8OrzxiYk5+Ai03 BxeYfkCaxZtgtFVz3xZKSzcmw4wUMpIbQLi0foyciwPMGS4YAAevmQM6ZOfS2E8ELfvf 7M+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=d1shtGpCRPpbkzCh0O6KuRofHNofaisXbVt5pckFwoU=; b=Gqs4iDl9GohEJejZS3ZqG5hCSvPECZt8LUYJjTWTMnenNVcsv4NGMbxsdT9QWShFm1 MtbbNUp/f2pHQaujQlc+U6c8sAMkGUexfE3h7XGsmXfwgSBrKsC+t8tEwjxfpMh+7C2L VOjCjxjJkK2wdY2DrdenraZ3/1D8mBic6ao2Bs4xs1CsBWuO6cm1PsoUuhCH8gkWFwTi NSEcVROSHKSG2nWYqC8EH5GBE+yikUgalo9soXw+my2zVubbFXls7FUW5A1R3vH61Xsn 0t9KvwTF4Iy4rNnQpkxArkD7NYKmMzDnPRKHdXBQ9edU6F5Xt1LcvorwVAxetsQidcMN EtdA== X-Gm-Message-State: AOAM532bK5fQPUZdR5kIZol3uuTcwjOovkpTgJnB5dKSlFCEV5vBMa3M 6yFV4JsEggx/8u4zOTm6PxKS5dqWspM= X-Google-Smtp-Source: ABdhPJynJwkDE7hfykHq9XB79I7ijMwLLARJxAMRTgm0/Ax6ujwshDzam0rNoRRkOwpHbkqr70kbIg== X-Received: by 2002:a63:e909:: with SMTP id i9mr32042795pgh.162.1632302567501; Wed, 22 Sep 2021 02:22:47 -0700 (PDT) Received: from tim-desktop ([124.149.107.149]) by smtp.gmail.com with ESMTPSA id c1sm1653652pjd.35.2021.09.22.02.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 02:22:47 -0700 (PDT) References: <72C6EDD6-39E3-47A9-B313-A4D6C7AF0C44@fairwindsoft.com> <875yutl6l8.fsf@gmail.com> User-agent: mu4e 1.7.0; emacs 28.0.50 From: Tim Cross To: Tim Uckun Cc: pgsql-general@lists.postgresql.org Subject: Re: Timestamp with vs without time zone. Date: Wed, 22 Sep 2021 19:11:45 +1000 In-reply-to: Message-ID: <87wnn9j76k.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tim Uckun writes: > I'll add another layer of complication. > > You have a database server hosted in Australia, and that's also where > your web server and api server is. You have customers all over the > world though so you set up additional API servers in Europe, USA, > Japan etc. > > A korean user will fetch you single page app as static HTML from S3 > with cloudfront. It will hit your japanese API server, which will > fetch the data from your japanese read only replica with the master > being in Australia. > > The master DB writes the records has to know your end user is in > Korea somehow so you have to carry that time zone all the way across > those tiers. > > To me the ideal solution would be to have a compound object which has > the time zone in it. This object gets passed through the tiers and end > up at the database where it's stored. > I wouldn't do it that way. I would have all timestamps in UTC. If the location of the client is necessary for some business process, then I would explicitly record that information rather than rely on time zone data to derive location. I've also found having all timestamps in UTC makes any analysis and bug tracing much easier. Nothing worse then when you need to look at timestamps from different components of your architecture spread over different time zones where you also have to convert the timestamps to a common/consistent time zone for comparison and sequencing purposes.