Mysql – Large table delete in thesql

deleteMySQLmysql-5.5

I want to delete a table with 10,000,000 records. Due to some restrictions I can't do truncate on that table (I don't have the DROP privilege), I can think of two options:

  1. DELETE QUICK

  2. To set some table level logging off so that mysql doesn't put data
    in rollback segments and that could make it faster as it happens
    in oracle.

Please throw some light on it while keeping in mind that I can't use TRUNCATE.

Best Answer

If you don't have privileges to DROP table you should DELETE in chunks.

Use MySQL Limit clause to delete in chunks.

DELETE FROM TABLE_NAME LIMIT 10000;