Hi,

>     $sth = $dbh -> prepare ("LOCK TABLES $table WRITE");
>     die $dbh->errstr if (not defined ($sth -> execute));
>
>     $sth = $dbh -> prepare ("DELETE FROM $table");
>     die $dbh->errstr if (not defined ($sth -> execute));
>
> This truncated the table. Then I filled the table anew, and, at the end
> (before the UNLOCK), issued:
>
>     $sth = $dbh -> prepare ("OPTIMIZE TABLE $table");
>     die $dbh->errstr if (not defined ($sth -> execute));

One question... why are you bothering to optimize the table after inserting
new rows? In this case, there is no need!

Why? Well, when you issue the DELETE statement with no WHERE clause, MySQL
simply drops and re-creates your table, rather than deleting every row
individually. Therefore, when you are inserting new rows, it is effectively
a fresh table, with no wasted space from previously deleted rows. So, you
are not re-using any deleted rows at all.

Regards,

Basil Hussain
---------------------------------------
Internet Developer, Kodak Weddings
E-Mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to