From: Royce Ausburn <royce.ml@inomial.com>
To: Pierre C <lists@peufeu.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Auto-clustering?
Date: Sun, 19 Dec 2010 14:07:48 +1100
Message-ID: <7D858BE2-BA54-4917-B9F1-2E0A7B49C8F8@inomial.com> (raw)
In-Reply-To: <op.vnusbnnqeorkce@apollo13>
References: <E03CB9AF-169C-47CA-B82D-645C8D6E94D9@inomial.com>
<op.vnusbnnqeorkce@apollo13>
On 17/12/2010, at 9:20 PM, Pierre C wrote:
>
>> fc=# explain analyse select collection, period, tariff, sum(bytesSent), sum(bytesReceived), sum(packets), max(sample), (starttime / 3600) * 3600 as startchunk from sample_20101001 where starttime between 1287493200 and 1290171599 and collection=128 and ip = '10.9.125.207' group by startchunk, tariff, collection, period;
>
> If CLUSTER locks bother you, and you don't do UPDATEs, you might consider doing something like this :
>
> - accumulate the rows in a "recent" table
> - every hour, INSERT INTO archive SELECT * FROM recent ORDER BY (your cluster fields)
> - DELETE FROM recent the rows you just inserted
> - VACUUM recent
>
> The cluster in your archive table will not be perfect but at least all rows from 1 source in 1 hour will be stored close together. But clustering doesn't need to be perfect either, if you get 100x better locality, that's already good !
That's a really decent idea and can slot in perfectly well with how the application already works! We have existing DBAO code that handles monthly tables; it'll happily pop data in to a recent table.... In fact we can probably tolerate having a "today" table. Thanks!
--Royce
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-performance@postgresql.org
Cc: royce.ml@inomial.com, lists@peufeu.com
Subject: Re: Auto-clustering?
In-Reply-To: <7D858BE2-BA54-4917-B9F1-2E0A7B49C8F8@inomial.com>
References: <E03CB9AF-169C-47CA-B82D-645C8D6E94D9@inomial.com> <op.vnusbnnqeorkce@apollo13> <7D858BE2-BA54-4917-B9F1-2E0A7B49C8F8@inomial.com>
* 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