Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

thinc (3788)

thinc
  (email not shown publicly)

Journal of thinc (3788)

Friday April 30, 2010
03:30 PM

Finding the postgresql tables that have been clustered

[ #40336 ]

At $work we have a job that runs every night that calls clusterdb [1] on our database. clusterdb reruns cluster [2] against any tables that have previously been clustered.

If you want to know which tables have previously had cluster run on them, the following query does the trick:

SELECT pg_class.relname, pg_index.indisclustered FROM pg_class JOIN pg_index ON pg_class.oid = pg_index.indrelid AND pg_index.indisclustered = 't';

This will list all the tables that cluster will reorder.

[1] http://www.postgresql.org/docs/8.3/static/app-clusterdb.html/

[2] http://www.postgresql.org/docs/8.3/static/sql-cluster.html/

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.