Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 04 Dec 2003 @ 13:53:53 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Help with creation of collect stats script
 
From:   Geoffrey Rommel

The ingenuity displayed in this thread has been impressive. You could also use a Perl script. Below is an excerpt from such a script which uses "help index" to get the description of all indexes and then collects stats on each one.

#---------------------------------------------------------------------
#  Collect stats on all indexes of a table.
#---------------------------------------------------------------------
sub collect_on_indexes {
 my ($dt) = shift;

#--- Get the index specs
 @ind = ();
 $hh = $dbh->prepare("help index $dt");
 $hh->open;
 while (@r = $hh->fetchrow_list) {
    ($iname, $ispec) = @r[5,2];
    if ($iname) { push @ind, $iname; }
    else { push @ind, "($ispec)"; }
 }
 $hh->close;

#--- Collect stats on them
 foreach $i (@ind) {
    issue_collect("collect statistics on $dt index $i");
 }

 return;
}


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 23 Jun 2019