pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Simon Riggs <simon@2ndquadrant.com>
To: Chris Hoover <revoohc@gmail.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: constraint_exclusion on OLTP tables
Date: Wed, 15 Feb 2006 21:20:15 +0000
Message-ID: <1140038415.12131.147.camel@localhost.localdomain> (raw)
In-Reply-To: <1d219a6f0602130650l690a255amf4bb68ceab914e3b@mail.gmail.com>
References: <1d219a6f0602130650l690a255amf4bb68ceab914e3b@mail.gmail.com>

On Mon, 2006-02-13 at 09:50 -0500, Chris Hoover wrote:

> The problem I am having is how can you safely move records between
> main_table_live and one of the other partition tables?  Obviously,
> this will have to happen as our users work the data and the records
> enter into on of the 2 closed statuses ('C' or 'D').  When the status
> is changed to C or D, I need to first move the record and run an
> update against the moved record to make sure all fields are updated
> and our auditing triggers are fired. 

My not just delete from the live table and insert into the partitioned
history table? That can be done atomically and with triggers.

Alternatively, keep all versions of the record as it develops over time
so the key becomes PK+timestamp and all writes are inserts. That way you
don't need an audit table, since you never change data, so probably
overall a smaller system and one less prone to bugs in the data update
processes.

Best Regards, Simon Riggs






view thread (3+ messages)

Message-ID: <1140038415.12131.147.camel@localhost.localdomain>
Permalink:  ../1140038415.12131.147.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1140038415.12131.147.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: simon@2ndquadrant.com, revoohc@gmail.com
  Subject: Re: constraint_exclusion on OLTP tables
  In-Reply-To: <1140038415.12131.147.camel@localhost.localdomain>
  References: <1d219a6f0602130650l690a255amf4bb68ceab914e3b@mail.gmail.com> <1140038415.12131.147.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox