Re: WIP: System Versioned Temporal Table

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Hannu Krosing <hannuk(at)google(dot)com>
Cc: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, vignesh C <vignesh21(at)gmail(dot)com>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Surafel Temesgen <surafel3000(at)gmail(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Rémi Lapeyre <remi(dot)lapeyre(at)lenstra(dot)fr>, Ryan Lambert <ryan(at)rustprooflabs(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Eli Marmor <eli(at)netmask(dot)it>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Georgios <gkokolatos(at)protonmail(dot)com>, Li Japin <japinli(at)hotmail(dot)com>
Subject: Re: WIP: System Versioned Temporal Table
Date: 2021-09-20 05:09:46
Message-ID: CADkLM=fErbWUS2aWcYyO4sMSHKqajd+w+yhQQyEj2X99_tBDbQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 19, 2021 at 3:12 PM Hannu Krosing <hannuk(at)google(dot)com> wrote:

> A side table has the nice additional benefit that we can very easily
> version the *table structure* so when we ALTER TABLE and the table
> structure changes we just make a new side table with now-currents
> structure.
>

It's true that would allow for perfect capture of changes to the table
structure, but how would you query the thing?

If a system versioned table was created with a column foo that is type
float, and then we dropped that column, how would we ever query what the
value of foo was in the past?

Would the columns returned from SELECT * change based on the timeframe
requested?

If we then later added another column that happened to also be named foo
but now was type JSONB, would we change the datatype returned based on the
time period being queried?

Is the change in structure a system versioning which itself must be
captured?

> Also we may want different set of indexes on historic table(s) for
> whatever reason
>

+1

>
> And we may even want to partition history tables for speed, storage
> cost or just to drop very ancient history
>

+1

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2021-09-20 05:27:13 Re: POC: Cleaning up orphaned files using undo logs
Previous Message Corey Huinker 2021-09-20 04:57:11 Re: WIP: System Versioned Temporal Table