The following is excerpted from the official documentation:
Grammar:
DELETE [low_priority] [QUICK] [IGNORE] Fromtbl_name[PARTITION (partition_name,...)] [WHEREwhere_condition] [ORDER by ...] [LIMITrow_count]
Performance:
When you don't need to know the number of deleted rows, theTRUNCATE TABLEStatement is a faster-to-empty a table than aDELETEStatement with noWHEREClause. UnlikeDELETE,TRUNCATE TABLECannot is used within a transaction or if you have a lock on the table. Seesection 14.1.34, "TRUNCATE TABLE Syntax" and section 14.3.5, "LOCK TABLES and UNLOCK TABLES Syntax".
The simple understanding is: Truncate in the case of not locking the table, soon:
If you want to delete the quick point with delete:
The time required to delete individual rows in aMyISAMTable is exactly proportional to the number of indexes. To delete rows more quickly, you can increase the size of the key in the cache by increasing thekey_buffer_sizeSystem variable
Key_buffer_size size that can be configured
Multiple table deletions:
(1) without aliases
DELETE T1, t2 from T1 INNER join T2 INNER join T3where t1.id=t2.id and t2.id=t3.id;
Or:
DELETE from T1, T2 USING T1 INNER join T2 INNER join T3where t1.id=t2.id and t2.id=t3.id;
(2) Aliases: Must write aliases:
If you declare an alias for a table, you must use the alias when referring to the table:
DELETE t1 from test as T1, Test2 WHERE ...
Correct:
DELETE A1, A2 from T1 as A1 INNER joins T2 as A2where a1.id=a2.id;delete from A1, A2 USING T1 as A1 INNER join T2 as A2wher E a1.id=a2.id;
Mysql Delete operation