Re: temporal support patch

From: Miroslav Šimulčík <simulcik(dot)miro(at)gmail(dot)com>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: temporal support patch
Date: 2012-06-13 20:35:28
Message-ID: CAHRNM6_WFQ_XA+MQD4HHigYOFy0qPBE8-2kdS=xEUeeNLir7MQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/5/30 Jim Nasby <jim(at)nasby(dot)net>

> On 5/18/12 2:06 AM, Miroslav Šimulčík wrote:
>
>> - no data redundancy - in my extension current versions of entries are
>> stored only once in original table (in table_log - entries are inserted to
>> both original and log table)
>>
>
> That's not necessarily a benefit... it makes querying for both history
> *and* current data a lot more complex. Table inheritance might be an
> elegant solution to that, but I doubt you could just bolt that on top of
> what you've created.
>

Yes, querying for history data is more complex, but i focused on preserving
the performance of current queries. That's the reason why I use separate
table for old versions.

Table inheritance is very good idea and it will not require so much effort
to use it in my solution. Currently, when user queries whole history of
entries, table reference in FROM clause is replaced with subselect, which
access data in both tables. For example when user executes command:

NONSEQUENCED TRANSACTIONTIME SELECT * FROM person;

The actually executed command is:

SELECT * FROM (SELECT * FROM person UNION ALL SELECT * FROM person_hist) as
person

Use of table inheritance can make things simpler and more elegant, but I'm
not sure about how it affect performance. Will it cause gain in performance?

The timestamp fields need to have timezone info. If you change the timezone
> for a connection you will get inconsistent results without it.
>
> _sys_end should either be NULLable or if it's going to have a magic value
> that magic value should be "Infinity":
>

Good point. I will use timestamp with timezone and value "Infinity"
instead of max timestamp value

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-06-13 20:55:45 Re: Is cachedFetchXidStatus provably valid?
Previous Message Gabriele Bartolini 2012-06-13 20:12:18 Re: [PATCH] Support for foreign keys with arrays