[thelist] MySQL Speed Question

Ditty, Christopher J - Memphis, TN CDitty at email.usps.gov
Wed Dec 4 12:19:01 CST 2002


     I am writing a php import script and someone I was talking to
     suggested an alternative method for something I am doing.

     I am importing roughly between 2,000 - 700,000 lines into a mysql
     database.  To make sure all the data is fresh and updated, I delete
     any previous stored information.  My method of doing this is to add a
     timestamp column to each table.  When I import, I populate this field
     with the current timestamp.  After I am finished importing the data, I
     simply delete all data that does not match the timestamp.  The only
     drawback that I can see doing this is that the database vitually has
     duplicate records of everything in it until it finishes the delete.
     This is not really a problem.  My friend suggested using a temp table,
     dropping the production table and then renaming the temp table to the
     production name.  Other than the fact that the site is down for a
     minute, why should I not consider using this method?

     Any thoughts?

     Chris



More information about the thelist mailing list