[TYPO3-core] RFC: Bug #13508: Use exec_TRUNCATETABLEquery() instead of DELETE FROM throughout the core

Christian Kuhn lolli at schwarzbu.ch
Thu Feb 11 02:31:26 CET 2010


This is an SVN patch request.

Type: Bugfix / Performance improvement

BT: http://bugs.typo3.org/view.php?id=13508

Branch: trunk

Problem:
Thanks to #13504 we now have a dbal compatible way of truncating tables. 
mysql handles this much more efficiently than delete from.

Solution:
Use this new API method core wide where DELETE FROM with an empty WHERE 
is called.

Notes:
- There is a nice performance improvement for the clearing of cache 
tables (if not using caching framework, which already did a direct 
TRUNCATE), especially if they are filled with hundreds of thousands of 
records on a system under load. mysql "truncate" is way faster than 
"delete from", especially on innodb where concurrent queries where 
usually stuck because of innodb's transaction capabilities.

- Warning: In comparison to delete, truncate does (!) reset the 
auto_increment value to zero. Because of this I'm currently not 100% 
sure about the two hunks in 
typo3/sysext/extbase/Classes/Utility/Cache.php and the second hunk in 
typo3/sysext/install/mod/class.tx_install.php. Please review carefully.

Thanks
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 13508_01.diff
Type: text/x-patch
Size: 6235 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100211/260ea71b/attachment-0001.bin>


More information about the TYPO3-team-core mailing list