Submitted by: K. A. (parshua)
DELETE is both costly and slow.
This will have all the aforementioned features without the cons.
The text was updated successfully, but these errors were encountered:
Commented by: K. A. (parshua)
Block if the table is referenced by foreign keys.
TRUNCATE marks/deallocates the pages, and does not use transaction log, so it is considered as a DDL command.
By using the REUSE SPACE keyword, the pages will not return to page pool, otherwise, the pages will be deallocated.
It's worth mentioning that the kind of tables which this command is used for, are tables which contain some kind of prolonged temp data in nature, like log tables and calculation tables.
These kind of tables are not referenced by foreign keys and most of the time, they do not refer to other tables. They may be populated several times in a short period, and remain so for a longer period.
In our case, we calculate results for quiz data taken by some hundred thousands of students, and we may erase and recalc several times in the quiz day (Due to some feedback about quiz questions). There are two tables: One for overall quiz result, and another for some analysis for every single quiz answer (a quiz consists of ~250 questions).Then after the final calculation and publishing the results (That same evening), the system will remain so until the next quiz which will be in a week or two.
Commented by: Ann Harrison (awharrison)
Be really careful with this one - it's been a significant problem in the Falcon storage
Firebird has mechanisms for recognizing that a transaction (and connection?) has
What we (Falcon/MySQL) decided to do about foreign key relationships was to
Truncate is very handy when you're developing an application, but its utility in a
Commented by: Milan Babuskov (milan.babuskov)
Perhaps the first implementation of this feature would only allow truncate tables that:
- are not referenced by foreign keys
I would gladly give up FK or triggers to have this feature.