Just a quick MySQL optimization note. Many times we're required to clear a database table and reset the auto increment counter. This is common with import scripts (importing data from Excel, etc).

The uncool way to do it:

DELETE FROM myTable
ALTER TABLE myTable AUTO_INCREMENT = 1

The cool (and more efficient) way to do it:

TRUNCATE TABLE myTable

 

Noting that the TRUNCATE statement automatically resets the counter.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *