Tuesday, March 6, 2012

About the use of TRUNCATE TABLE command

Hi all,
I have a big table with 54 Million of records. I want to use the TRUNCATE TABLE command to eliminate all the records. I don't want to drop the table, just delete records.

But I have questions about the use of this command:

1) How much time does this command execution could it take?
2) I want to this (I need to this) in production enviroment. Will you do it?

Thanks in advance!

Hi,

1) This depends on your machine, Truncate table just deallocates the data pages and uses a minimum of log space, it should be quiet fast for your 54m rows.
2) What do you mean, if we WOULD (or will ? You probably will have to do it :-)) do it ? You will have to keep in mind that there is NO way back after truncating, the only way would be to restore the data from a backup.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||Hi and thanks Jens,

1) Ok, the machine is in production environment. So, that's my worry. I'm asking this to have an idea about the time this command spends in an production environment. I don't want to get the server slow for this command.
2) And yes, I know that this action delete rows and don't log to much: that's what I need.

Thanks again.

No comments:

Post a Comment