Re: [PATCHES] Maintaining cluster order on insert

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: genekhart(at)gmail(dot)com
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, jonah(dot)harris(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Maintaining cluster order on insert
Date: 2006-08-10 08:23:39
Message-ID: 44DAED0B.8010007@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Gene wrote:
> You are correct the main part I'm worried about is the updates, being
> so far from the originals.

Yeah, you won't benefit from the patch at all.
> The reason I'm doing the clustering is I was hoping that with the
> "stable" non-updating partitions I could execute a CLUSTER at night
> (slow...) and it would compact the tables into their most efficient
> state for querying which always involves a date range. bad idea? In
> this fillfactor feature, will you be able to set it to 100% once you
> know that no more updates will occur? Or will doing a cluster
> effectively do this? Will the fill factor only apply for inserts?

That sounds like a good approach. CLUSTER obeys the fillfactor, so
you'll want to set it to 100 for the older partitions before you CLUSTER.

You might want to experiment with the fillfactor. You might get the best
performance if you just set it to 100 even for the latest partition, if
your queries usually have to scan most of it anyway. Fillfactor 100 will
help to keep it dense and in memory, so it won't matter so much if it's
disorganized.
> "Your best bet might be to partition the table into two subtables, one
> with "stable" data and one with the fresh data, and transfer rows from
> one to the other once they get stable. Storage density in the "fresh"
> part would be poor, but it should be small enough you don't care."
>
> This sounds interesting, I could create a RULE/INSERT on the unstable
> table, I will know during the update if it is ready to be put in the
> stable table. What would be an efficient way to do the transfer? Since
> the updates occur somewhat randomly, wouldnt the tuples in the stable
> table then be out of natural timestamp order?
I'm not sure I understand the last sentence. I thought the updates
usually occur within 30 minutes of the insert. So if you transfer the
rows to the stable table after 30 minutes, there won't be updates to the
stable table.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message stark 2006-08-10 10:59:11 Re: [HACKERS] Maintaining cluster order on insert
Previous Message Heikki Linnakangas 2006-08-10 08:11:08 Re: Maintaining cluster order on insert

Browse pgsql-patches by date

  From Date Subject
Next Message stark 2006-08-10 10:59:11 Re: [HACKERS] Maintaining cluster order on insert
Previous Message Heikki Linnakangas 2006-08-10 08:11:08 Re: Maintaining cluster order on insert