Re: FW: bitemporal functionality for PostgreSQL

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Jeff Davis" <pgsql(at)j-davis(dot)com>
Cc: "Luke Porter" <luke_porter(at)hotmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FW: bitemporal functionality for PostgreSQL
Date: 2008-02-03 10:48:24
Message-ID: 47A59BF8.3030408@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis wrote:
> On Fri, 2008-02-01 at 15:42 +0000, Luke Porter wrote:
>> All
>>
>> Is there an interest in developing bitemporal functionality in
>> PostgreSQL
>>
>
> I am very interested in this topic, and I maintain the pgsql-temporal
> project at:
>
> http://pgfoundry.org/projects/temporal/
>
> It's missing good docs and a few other things that I'd like, but it
> provides a good time interval type, including lots of useful operators,
> and GiST index support functions.
>
> For instance, you can do queries like:
>
> SELECT att1 FROM mytable WHERE during @> '2001-05-11
> 01:01:01'::timestamptz;
>
> which is a simple way to get all records where "during" contains the
> point in time '2001-05-11 01:01:01'. It's also indexable with GiST,
> meaning that query will perform well in a variety of situations.

I don't know what "bitemporal" is all about, but to me, the
pgsql-temporal approach is clearly the most flexible and attractive.
Good interval handling is not limited to just time, BTW, there's other
applications that deal with intervals of other types like floats, though
time intervals are the most common.

We can get pretty far with a pgfoundry project, providing a good
interval data type with operators, but there's a few things that would
need backend support. For example, queries like:

SELECT * FROM mytable1;
timeatt
-------
10 - 20
30 - 40

SELECT * FROM mytable2,
timeatt
-------
15 - 35

SELECT * FROM mytable1
INTERSECT
SELECT * FROM mytable2;
timeatt
-------
15 - 20
30 - 35

as well as declaring uniqueness constraints, so that there's no rows
with overlapping intervals, foreign key references on intervals etc.

I would suggest a book called "Temporal Data and the Relational Model",
by C. J. Date, Hugh Darwen and Nikos A Lorentzos to anyone who's
interested in temporal issues. It presents a very elegant solution to
temporal issues, fully compatible with the relational model. Unlike
"time travel" kind of approaches.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-02-03 11:55:31 Re: configurability of OOM killer
Previous Message Neil Conway 2008-02-03 05:49:17 Re: RFC: array_agg() per SQL:200n