Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux