This is an important point to understand before using truncate or delete on production environment, or writing any script which purges data from tables.
1. Truncate is fast delete is slow.
2. Truncate doesn't do logging delete logs on per row basis.
3. Rollback is possible with delete not with truncate until specifically supported by vendor.
4. Truncate doesn't fire trigger, delete does.
5. Don't delete, truncate it when it comes to purge tables.
6. Truncate reset identity column in table if any, delete doesn't.
7. Truncate is DDL while delete is DML (use this when you are writing exam)
8. Truncate doesn't support where clause, delete does.
So finally If you have table with huge data and want to empty it don’t Delete, truncate it
1) If you have table which contains large amount of data which command will you use for removing data, truncate or delete?
2) What are differences between truncate and delete?
3) Which one is fast truncate or delete?
4) What is disadvantage of using truncate in sql?
5) How will you delete data if truncate is not supported and log segment is also not big enough to support complete delete?
6) Is there any way to remove data other than truncate and delete in SQL?
1. Truncate is fast delete is slow.
2. Truncate doesn't do logging delete logs on per row basis.
3. Rollback is possible with delete not with truncate until specifically supported by vendor.
4. Truncate doesn't fire trigger, delete does.
5. Don't delete, truncate it when it comes to purge tables.
6. Truncate reset identity column in table if any, delete doesn't.
7. Truncate is DDL while delete is DML (use this when you are writing exam)
8. Truncate doesn't support where clause, delete does.
So finally If you have table with huge data and want to empty it don’t Delete, truncate it
1) If you have table which contains large amount of data which command will you use for removing data, truncate or delete?
2) What are differences between truncate and delete?
3) Which one is fast truncate or delete?
4) What is disadvantage of using truncate in sql?
5) How will you delete data if truncate is not supported and log segment is also not big enough to support complete delete?
6) Is there any way to remove data other than truncate and delete in SQL?
No comments:
Post a Comment