From: | Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> |
---|---|
To: | David Johnston <polobo(at)yahoo(dot)com> |
Cc: | Daniel Farina <daniel(at)heroku(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Finding latest record for a number of groups in an INSERT-only table |
Date: | 2011-07-05 06:55:19 |
Message-ID: | 02798E69-30C6-4DB5-AB73-A22F8C7D8A76@solfertje.student.utwente.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 on SELECT?
> 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!
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Farina | 2011-07-05 07:13:39 | Re: Finding latest record for a number of groups in an INSERT-only table |
Previous Message | Yan Cheng CHEOK | 2011-07-05 06:50:53 | Difference between inet and cidr |