Re: Tracking mutations in table data

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Chris Coutinho <chrisbcoutinho(at)gmail(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Tracking mutations in table data
Date: 2020-04-06 02:30:35
Message-ID: CAKFQuwY_gKjmyB77S-qyDT+QNqHT5gbxp01pgM5jQpbWdpokSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sun, Apr 5, 2020 at 3:06 PM Chris Coutinho <chrisbcoutinho(at)gmail(dot)com>
wrote:

> In addition to the IoT events themselves, I want to log the mutations
> in the metadata of each device.

Why?

My question is, what are the best practices regarding tracking this
> metadata

Do the simplest thing allowed while ensuring you retain all of the data and
an associated timestamp or version.

> I've done a little research into history tables and
> (bi-)temporal tables,

This seems like overkill.

> and I'm little lost based on all of the options
> available. In short, I want some kind of history table of mutations in
> the devices table so that I can see when the metadata is
> inserted/updated/deleted.
>

So create one, then populates its contents using insert/update/delete
triggers on the observed table.

I'm also hosting this server on a managed Azure instance, which is
> somewhat limited in the number and kinds of extensions available.
>

Triggers are core functionality.

David J.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Valentin Czisch 2020-04-06 11:38:39 PQencryptPasswordConn called using PostgreSQL9.6.
Previous Message Chris Coutinho 2020-04-05 22:06:09 Tracking mutations in table data