[TYPO3-dev] How standard compliant is "truncate"?
ries van Twisk
typo3 at rvt.dds.nl
Thu Feb 5 12:54:16 CET 2009
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....
A API in the db class would be on it's place.
..->getTruncateSQLCommand(Array $tables);
Would return the appropriate commands for the tables on the currently
running DB.
Ries
More information about the TYPO3-dev
mailing list