Wednesday, May 14, 2014

Delete and Truncate Command

Delete Command
Truncate Command
Delete command supports where clause and hence it can be used for deleting only
It does not support where clause and hence, it can be used only when you want to delete all rows from the table.
Delete command deletes rows one by one
It deletes the rows page by page Hence deleting all the rows from table, will be fast with truncate , compared to Delete
When there is identity on a table and you delete all rows the table using Delete than the current value of identity will not be reset to it seed
When there is identity on a table and you delete all rows from table, using truncate command, then the current value of identity will be reset to it seed.
Slow in execution
Fast in execution
Restoring is possible
Restoring is not possible
Delete command will not deallocate the memory after deleting the rows, hence delete command comes under data manipulation language
It will deallocate the memory after deleting the data by keeping one extend for the table, hence truncate comes under data definition language


No comments:

Post a Comment

Thank you for visiting my blog

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...