Which timestamp type should I choose in a PostgreSQL database?

后端 未结 3 859
[愿得一人]
[愿得一人] 2020-12-07 06:55

I would like to define a best practice for storing timestamps in my Postgres database in the context of a multi-timezone project.

I can

  1. choose T
3条回答
  •  借酒劲吻你
    2020-12-07 07:38

    My preference is towards option 3, as Postgres can then do al ot of the work recalculating timestamps relative to timezone for you, whereas with the other two you'll have to do that yourself. The extra storage overhead of storing the timestamp with a timezone is really negligible unless you're talking millions of records, in which case you probably already have pretty meaty storage requirements anyway.

提交回复
热议问题