Tracking mutations in table data - Mailing list pgsql-novice

From Chris Coutinho
Subject Tracking mutations in table data
Date
Msg-id CAG+YirQg=4846+XEO0zRBUL52PjQ=MPmsyTV8Fid8nvNGGzMZg@mail.gmail.com
Whole thread Raw
Responses Re: Tracking mutations in table data  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Tracking mutations in table data  (Mark Kelly <pgsql@wastedtimes.net>)
List pgsql-novice
Hi all,

Relatively new to PostgreSQL, looking for guidance.

I have a schema that looks like this, it's being used to log IoT events:

create table devices (
    id serial primary key,
    meta1 int,
    meta2 text
)

create table events (
    datetime timestamp,
    device_id int references devices (id),
    code int,
    primary key (datetime, device_id)
)

In addition to the IoT events themselves, I want to log the mutations
in the metadata of each device. The metadata of each device changes
much less frequently than the rate at which events are inserted,
that's why I've opted to place the data into the devices table.

My question is, what are the best practices regarding tracking this
metadata? I've done a little research into history tables and
(bi-)temporal tables, 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.

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

Thanks in advance,
Chris



pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: chr(3) and 3::text
Next
From: "David G. Johnston"
Date:
Subject: Re: Tracking mutations in table data