Re: Temporal Table Proposal

Paul A Jungwirth <pj@illuminatedcomputing.com>

From: Paul Jungwirth <pj@illuminatedcomputing.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2019-02-22T21:16:02Z
Lists: pgsql-hackers
On 2/22/19 11:31 AM, Euler Taveira wrote:
> Em sex, 22 de fev de 2019 às 15:41, Ibrar Ahmed
> <ibrar.ahmad@gmail.com> escreveu:
>>
>> While working on another PostgreSQL feature, I was thinking that we could use a temporal table in PostgreSQL. Some existing databases offer this. I searched for any discussion on the PostgreSQL mailing list, but could not find any. Maybe my search wasn’t accurate enough:  if anyone can point me to a discussion, that would be useful.
>>
> https://www.postgresql.org/message-id/CA%2BrenyUb%2BXHzsrPHHR6ELqguxaUPGhOPyVc7NW%2BkRsRpBZuUFQ%40mail.gmail.com
> 
> This is the last one. I don't know why it wasn't in the January CF.

Oh that's by me! :-)

I didn't put it into the CF because I wanted to get some feedback on 
primary keys before I got too far into foreign keys, but someone 
recently advised me to starting adding to CFs anyway with "WIP" in the 
title, so I'll do that next time.

Btw my own patch is very modest, and I'd love to see this other much 
more extensive patch get some attention:

https://www.postgresql.org/message-id/flat/CAHO0eLYyvuqwF%3D2FsgDn1xOs_NOrFBu9Xh-Wq%2BaWfFy0y6%3DjWQ%40mail.gmail.com#4f7fbace3a2f2ce85fcc161cc3fdd273

They were told to adjust where in the query pipeline they do their work, 
and the latest patch does that (as I understand it), but I don't think 
anyone has looked at it yet.

Both of these patches use range types rather than SQL:2011 PERIODs, but 
I'd like to *also* support PERIODs (and accept ranges everywhere we 
accept PERIODs). Vik Fearing already has a patch to let you *declare* 
PERIODs:

https://www.postgresql-archive.org/Periods-td6022563.html

Actually using PERIODs in queries seems like a decent chunk of work 
though: basically it means making our grammar & processing accept 
PERIODs anywhere they currently accept columns. I'd love to hear some 
thoughts/suggestions around that. For example: a PERIOD is *similar* to 
a GENERATED column, so maybe the work being done there can/should 
influence how we implement them.

I'm excited to be getting some momentum around temporal features though! 
I'm supposed to give a talk about them at PGCon in Ottawa this spring, 
so hopefully that will help too.

Yours,

-- 
Paul              ~{:-)
pj@illuminatedcomputing.com


Commits

  1. Fix bugs in mdsyncfiletag().

  2. Refactor the fsync queue for wider use.

  3. Don't forget about failed fsync() requests.

  4. PANIC on fsync() failure.

  5. Move LockClauseStrength, LockWaitPolicy into new file nodes/lockoptions.h.

  6. Add new file for checkpointer.c

  7. Split work of bgwriter between 2 processes: bgwriter and checkpointer.

  8. Install infrastructure for shared-memory free space map. Doesn't actually