What is difference between TRUNCATE & DELETE?
Answer Posted / ameya aloni
TRUNCATE:
1. Faster - does its work in single execution by
deallocating the data pages used by the table and reducing
the resource overhead of logging the deletions, as well as
the number of locks acquired.
2. Is DDL command
3. Removes all data
4. Does not make entries in a LOG file
3. Can't be rolled-back
4. Can't filter using WHERE clause
5. Can't call DML triggers
6. Can't ensure data consistency in case of foreign-key
references
7. Resets the IDENTITY back to the SEED
DELETE:
1. Slower - does its work by deleting rows one at a time,
logging each row in the transaction log, maintaining log
sequence number (LSN) information and consuming more
database resources and locks.
2. Is DML command
3. Removes data row-by-row
4. Makes entry per row in a LOG file
3. Can use COMMIT or ROLLBACK
4. Can filter using WHERE clause
5. Can call DML triggers
6. Ensures data consistency in case of foreign-key references
7. Does not reset the IDENTITY
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
list out some tools through which we can draw e-r diagrams for mysql. : Sql dba
What do you mean by stored procedures?
What plvcmt and plvrb does in pl/sql?
What is using in sql?
How to start the command-line sql*plus?
Why do we use sql constraints?
how to fetch common records from two tables? : Sql dba
How do I create an index in word?
what is an index? : Sql dba
What is pl sql record in oracle?
What are the usages of sql?
What is left inner join in sql?
what are the security recommendations while using mysql? : Sql dba
what are the t string functions available in tsql? : Transact sql
is mysql query is case sensitive? : Sql dba