mos wrote:
I have a merge table that is a union of 20 1 million row tables. Select rows from it is quite fast. However if I want to delete all the rows as in:

delete from MyMergeTable;

it takes just over 3 minutes. I could execute 20 separate delete statements for each of the 20 tables and it would complete in under a second. Why is a Delete on a merge table so inefficient? It appears it is deleting all the rows individually.

That's the way delete works - it deletes the rows one at a time. It also has to update the indexes as it goes to remove links between the data & index.

http://dev.mysql.com/doc/refman/5.0/en/delete.html
http://dev.mysql.com/doc/refman/5.0/en/delete-speed.html

If you're clearing the whole table, use truncate as Jerry suggested.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to