[TYPO3-dev] How standard compliant is "truncate"?

Martin Kutschker masi-no at spam-typo3.org
Thu Feb 5 13:05:53 CET 2009


ries van Twisk schrieb:
> 
> On Feb 5, 2009, at 6:35 AM, Steffen Kamper wrote:
> 
>> Hi,
>>
>> Martin Kutschker schrieb:
>>>
>>> Is truncate really faster?  I assumed that a DELETE without a WHERE
>>> clause will work internally the same as a TRUNCATE.
>>>
>>
>> for sure. We had some clients where clear cache lead to server crash.
>> Truncate does the job in less a minute there. (MySQL)
>>
>> vg Steffen
> 
> truncate and delete without a where clause are not the same.
> 
> Truncate will usually not fire an ON DELETE triggers and foreign
> references to wards the truncated table are not checked. if there are
> foreign references
> the truncate will not continue and you have to truncate them all at the
> same time.
> Implementations depend on the vendor but since TYPO3 is so simple in
> it's DB design the result of the command  would
> almost be the same on all RDBM's
> 
> There is no TRUNCATE command in the SQL standard but it's implemented at
> some DB vendors. Oracle, MySQL, PostgreSQL, mssql seems to support it....

Oops, I really thought that PosgreSQL had no truncate. Maybe we don't
need a wrapper after all. But OTOH adding one doesn't hurt and maybe
helpful.

Masi




More information about the TYPO3-dev mailing list