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

Martin Kutschker masi-no at spam-typo3.org
Thu Feb 11 11:50:13 CET 2010


Dmitry Dulepov schrieb:
> On 2010-02-11 12:39:33 +0200, Martin Kutschker said:
>> But there is one significant difference. DELETE removes each row and
>> will therefore fire row
>> triggers. TRUNCATE doesn't do that. So if you use triggers it's not
>> only a matter of speed, it's a
>> trade-off between speed and integrity.
> 
> Yes, I thought of that and of auto_increment differencies. We do not use
> triggers in TYPO3 at the moment (SQL parse does not support them anyway)
> and deletion of the whole table happens only for cache tables. So both
> these differences should not play a major role.

Yes, not now, maybe never. Using TRUNCATE makes IMHO sense also for extensions, but of course - as
ever - developers should be aware of any subtleties or intricacies. TRUNCATE is not only a fast DELETE.

> May be we should write this all in function's phpdoc comments? If we
> ever decide to use triggers, we always can rethink the decision.

Adding docs never hurts.

Masi


More information about the TYPO3-team-core mailing list