Re: Finding latest record for a number of groups in an INSERT-only table - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Finding latest record for a number of groups in an INSERT-only table
Date
Msg-id 02798E69-30C6-4DB5-AB73-A22F8C7D8A76@solfertje.student.utwente.nl
Whole thread Raw
In response to Re: Finding latest record for a number of groups in an INSERT-only table  (David Johnston <polobo@yahoo.com>)
Responses Re: Finding latest record for a number of groups in an INSERT-only table  (Daniel Farina <daniel@heroku.com>)
List pgsql-general
On 5 Jul 2011, at 3:23, David Johnston wrote:

>> Does anyone have fresh thoughts or suggestions for dealing with
>> INSERT-mostly tables conceived in this manner?

You're struggling with read-performance in an INSERT-mostly table? Where are your performance priorities, on INSERT or
onSELECT? 

> Setup a materialized view.


Basically that means moving the tracking of the last row to the INSERT phase. If you go this way, a few approaches keep
a"latest records" table are: 
1. Replace the record with the same key with the latest one from your INSERT-mostly table, or
2. Update a foreign key reference to the latest record in your INSERT-mostly table.

The new table should probably have a UNIQUE constraint on the key field.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4e12b56712091122515968!



pgsql-general by date:

Previous
From: Yan Cheng CHEOK
Date:
Subject: Difference between inet and cidr
Next
From: Daniel Farina
Date:
Subject: Re: Finding latest record for a number of groups in an INSERT-only table