views:

52

answers:

1

Hi,

truncate ->this resets the entire table, is there a way via truncate to reset particular records/check conditions.

For ex: i want to reset all the data and keep last 30 days inside the table.

Thanks.

A: 

No, TRUNCATE is all or nothing. You can do a DELETE FROM <table> WHERE <conditions> but this loses the speed advantages of TRUNCATE.

ceejayoz
Thanks, assuming that condition, how do i keep last 10 days data and delete the rest (for say the table has 10 million records), in an optimized manner.
Sharpeye500
The speed from TRUNCATE is because it doesn't write to the logs
OMG Ponies