May 18, 2007 at 2:30 am
Hi
I have a table with a lot of data that needs to be deleted not all of it...This is Large amount of data more in size than in Qauntity of rows...The Delete has an inner join wich links to a nother table on n linked server..
I have done batches and subquery's in the delete but the thing just keeps on running throw the night...And I have to stop it in the morning cuase the transaction log makes the server slow...
Is there anayway I can do the delete without writing to the transaction log? Or just make this not take so long..?
May 18, 2007 at 3:10 am
What recovery model have you selected for your database? You should have Simple.
May 18, 2007 at 3:39 am
Yes the recovery model is on simple, but the problem here is thee amount of data there is a text field coulumn that is kinda big wich I think is the problem....Im all out of idees ..Thanx for the idee though
May 18, 2007 at 3:42 am
bcp out the data you want to keep, truncate the table and bulk insert it back in.
May 18, 2007 at 3:48 am
Hi thanks for the reply
Cant truncate Foreign key constraints and I am not sure but Disabling the constraints has passed my mind but it just does'nt seem right..They are there for a reason?
May 18, 2007 at 3:50 am
The bcp will work but with the size of the data this will take just as long? This will be a daily process aswell
May 18, 2007 at 5:48 am
i think BCP is the speedest method of all.
May 18, 2007 at 5:57 am
I agree the bcp will be n good way to do this but when I bcp all the data out , the data that is left still has Foreign key constraints on it...You cant use Truncate when the table has Foreign keys so even if I did this it still would'nt work...Maybe im understanding the whole bcp idee wrong?
May 18, 2007 at 7:45 am
you should script it as stored procedure which would be run as daily job. Maybe in this script you should be aware about all constraints, how to drop them and to be rebuilt.
May 18, 2007 at 8:00 am
Thanx,
This is obvisaly a cant do then...I apricate all the reply's...Its alredy a job that runs every night but the problem is it runs forever and I cant let it run during the day cause its a live enviroment...Im trying not to drop or disable the constraints...What im looking for is an alternative way??...I supose if there is some why of duing this without writing to the Transaction log that would be it but I geuse there is no way of bypassing that one...
May 18, 2007 at 8:32 am
You could try smaller batches. make sure they are not in the same transaction tho... and try sticking a backup log in between each statement. if you don't want the logs use the with truncateonly.
May 18, 2007 at 8:37 am
Thanx Sounds good Im gona try that...
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply