Issue Bug Closed

#17189Replace DELETE FROM with faster TRUNCATE TABLE

John Angel 04/04/07, 18:31 updated 08/06/10, 13:23

Description

Instead of:

$query = ‘DELETE FROM ‘. $components[‘TABLE’]. (strlen($where) ? ‘ WHERE ‘ . $where : ‘’);

Should be:

if(strlen($where))
{
$query = ‘DELETE FROM ‘. $components[‘TABLE’]. ‘ WHERE ‘ . $where;
}
else
{
$query = ‘TRUNCATE TABLE ‘. $components[‘TABLE’];
}

Ref source:
t3lib/class.t3lib_sqlparser.php:1367
t3lib/class.t3lib_db.php:427
sysext/adodb/adodb/adodb-perf.inc.php:662

Ref mysql doc:
http://dev.mysql.com/doc/refman/5.0/en/truncate.html

(issue imported from #M5370)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.