Обсуждение: timetz need more bytes than timestamptz

Поиск
Список
Период
Сортировка

timetz need more bytes than timestamptz

От
jian he
Дата:

Hi,
https://www.postgresql.org/docs/current/datatype-datetime.html
timetz, timestamptz:
same resolution.
fractional digits in the seconds field are also the same.
>
> All timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone specified by the TimeZone configuration parameter before being displayed to the client.

Why does timetz need more bytes (8 vs 12) than timestamptz?

Re: timetz need more bytes than timestamptz

От
Junwang Zhao
Дата:
timetz stores only the time units within a day, it uses an extra field
to store the zone info.

typedef int64 TimeADT;
typedef struct
{
    TimeADT time; /* all time units other than months and years */
    int32 zone; /* numeric time zone, in seconds */
} TimeTzADT;

timestamp is a count that starts on January 1st, 1970 at UTC.

You can convert a timestamp to any timezone, but not timetz.

On Mon, Jun 19, 2023 at 11:53 AM jian he <jian.universality@gmail.com> wrote:
>
>
> Hi,
> https://www.postgresql.org/docs/current/datatype-datetime.html
> timetz, timestamptz:
> same resolution.
> fractional digits in the seconds field are also the same.
> >
> > All timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone
specifiedby the TimeZone configuration parameter before being displayed to the client. 
>
> Why does timetz need more bytes (8 vs 12) than timestamptz?



--
Regards
Junwang Zhao