loading data, creating indexes, clustering, vacuum...

From: "Angva" <angvaw(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: loading data, creating indexes, clustering, vacuum...
Date: 2006-12-07 16:38:06
Message-ID: 1165509486.510735.194760@79g2000cws.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi everyone,

Looking for a small bit of advice...

I have a script that updates several tables with large amounts of data.
Before running the updates, it drops all indexes for optimal
performance. When the updates have finished, I run the following
procedure:

recreate the indexes
cluster the tables
vacuum full analyze on the tables

I was hoping an expert could comment on the optimal way to order these
three commands. For instance I have a hunch that creating the indexes
first (as I do now) could slow down the clustering - perhaps the row
locations in the indexes all have to be updated as the cluster command
shifts their locations? And perhaps vacuuming should be done before
clustering so that dead tuples aren't "in the way"?

Of course I could just test every combination until I get it right, but
I'd like to have a good understanding as well.

Any insight would be much appreciated.

Thank you,
Mark

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2006-12-07 16:50:57 Re: VACUUM and transactions in different databases
Previous Message Tom Lane 2006-12-07 16:28:30 Re: VACUUM and transactions in different databases