http://www.perlmonks.org?node_id=474740


in reply to Using Perl to clean up DBs?

Whichever approach you take, you need to make sure that the table is "re-organised" on a regular basis as well; otherwise those deleted rows may still consume space!

See your DB manual for more.

$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";

Replies are listed 'Best First'.
Re: Remember to re-org
by Thilosophy (Curate) on Jul 14, 2005 at 12:34 UTC
    On the other hand, they are log tables, the empty space will be reused to store new rows, so the space does not really go wasted. Reorganizing would just take space away from a table whose natural growth will see it extend itself again soon.

      It really depends on the RDBMS and the type of the table. There is no absolute "this is what happens to space freed by deleted rows". It's something that you need to find out about, preferably before all of your table space is gone and you don't know why.

      $h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";