Thread: Why is abstime type deprecated?

Why is abstime type deprecated?

From
Kilian Hagemann
Date:
Hi there,

Firstly, I am new to PostgreSQL but installed it recently because of its many
virtues for a project of mine. This is not a bug-report but rather a concern
about the development course of postgresql (hope this is the right place to
post this... please excuse me if it's not).

I am busy storing lots of weather station data into a database, each record
having a timestamp. Now the 'timestamp' type that PostgreSQL (and MySQL for
that matter) offers is 8 bytes long. Space is of the essence, and I found
that if I could use a 4 byte timestamp instead I could reduce the amount of
real (non-overhead) data in my db by 33%.

After long googling I found that abstime, as was still current in 6.x, would
do the trick for me. But the 7.x documentation says "You are discouraged from
using these types in new applications" and that "Any or all of these internal
types might disappear in a future release". The Version 8.0 History file
makes no indication of abstime disappearing, but I'm still worried about
implementing my database with abstime. Why is it deprecated? If it's not, why
does the documentation say it is?

I believe SQL standards come into play here but one could always keep abstime
as a PostgreSQL extension...

I don't need more than 1s resolution and such a type ideally satisfies the
requirements of my application. Quite frankly, I think that there aren't many
people out there who would require a microsecond precision and a date range
of 292000 years into the future...

Regards,

--
Kilian Hagemann

Climate Systems Analysis Group
University of Cape Town
Republic of South Africa
Tel(w): ++27 21 650 2748

Re: Why is abstime type deprecated?

From
Tom Lane
Date:
Kilian Hagemann <hagemann1@egs.uct.ac.za> writes:
> After long googling I found that abstime, as was still current in 6.x, would
> do the trick for me. But the 7.x documentation says "You are discouraged from
> using these types in new applications" and that "Any or all of these internal
> types might disappear in a future release". The Version 8.0 History file
> makes no indication of abstime disappearing, but I'm still worried about
> implementing my database with abstime. Why is it deprecated?

Because it will certainly break by 2038, when 32-bit time_t overflows.

In practice, Unix systems will have to move to 64-bit time_t before
that, and we'll probably either remove abstime or make it an 8-byte type
as soon as that practice is common.

            regards, tom lane

Re: Why is abstime type deprecated?

From
Kilian Hagemann
Date:
>
> Because it will certainly break by 2038, when 32-bit time_t overflows.
>
> In practice, Unix systems will have to move to 64-bit time_t before
> that, and we'll probably either remove abstime or make it an 8-byte type
> as soon as that practice is common.

Thanks for that. By that time my storage requirements will certainly have
changed, but I guess this transformation won't happen in a hurry... I'd like
to see abstime supported until at least 2020.

> TIP 5: Have you checked our extensive FAQ?

I have, and it doesn't have an entry on this. Don't know who maintains the
FAQ, but I think it would be worthwhile adding this issue to the FAQ.

--
Kilian Hagemann

Climate Systems Analysis Group
University of Cape Town
Republic of South Africa
Tel(w): ++27 21 650 2748

Re: Why is abstime type deprecated?

From
Bruce Momjian
Date:
Kilian Hagemann wrote:
> >
> > Because it will certainly break by 2038, when 32-bit time_t overflows.
> >
> > In practice, Unix systems will have to move to 64-bit time_t before
> > that, and we'll probably either remove abstime or make it an 8-byte type
> > as soon as that practice is common.
>
> Thanks for that. By that time my storage requirements will certainly have
> changed, but I guess this transformation won't happen in a hurry... I'd like
> to see abstime supported until at least 2020.
>
> > TIP 5: Have you checked our extensive FAQ?
>
> I have, and it doesn't have an entry on this. Don't know who maintains the
> FAQ, but I think it would be worthwhile adding this issue to the FAQ.

It is not an F(frequent)AQ because you are the first to ask about it in
perhaps years.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073