From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | A J <s5aly(at)yahoo(dot)com> |
Cc: | PG Admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: How frequently to defrag(cluster) |
Date: | 2011-07-20 21:16:32 |
Message-ID: | 4E2745B0.1010405@pinpointresearch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On 07/20/2011 02:04 PM, Steve Crawford wrote:
> On 07/20/2011 12:58 PM, A J wrote:
>> I understand that 'cluster' performs the role of defrag ...
> As with everything the answer is "it depends". For a "typical"
> workload where the rows updated by a single query are one or a few
> rowsl, the automatic vacuum process should handle everything for you
> without intervention (some tuning of the vacuum settings may be in
> order but it runs by itself).
>
>
> Also, there are some workloads that have queries that grab chunks of
> data, say all records for a given date, where keeping the associated
> data physically close can improve performance.
I should have explained better. Cluster physically orders the data in
the table in the same order as the index selected for the cluster. It is
this physical reordering of data that can improve performance by keeping
the data you are likely to retrieve in the same physical area. (Yes, the
data can be scattered by the OS but clustering still helps). Also note
that as you perform updates, the data will become more and more
unordered. If your workload benefits substantially from clustering, it
will have to be done periodically based on your workload and observed
performance degradation.
Another place where cluster is useful is following deletion of large
chunks of data as when archiving. For many workloads, however, table
partitioning using parent/child tables organized so that archiving can
be as simple as backing up then dropping a child table can be preferable.
Cheers,
Steve
From | Date | Subject | |
---|---|---|---|
Next Message | Johann Spies | 2011-07-21 14:11:01 | Out of memory |
Previous Message | Steve Crawford | 2011-07-20 21:04:59 | Re: How frequently to defrag(cluster) |