I have two SQL Servers, one for production, and one as an archive. Every night, we’ve got a SQL job that runs and copies the days production data over to the archive. As we’ve grown, this process takes longer and longer and longer. When I watch the utilization on the archive server running the archival process, I see that it only ever makes use of a single core. And since this box has eight cores, this is a huge waste of resources. The job runs at 3AM, so it’s free to take any and all resources it can find.
So what I need to do if figure out how to structure SQL Server jobs so they can take advantage of multiple cores, but I can’t find any literature on tackling this problem. We’re running SQL Server 2005, but I could certainly push for an upgrade if 2008 takes care of this problem.
Do you have an automated maintenance plan to update statistics, rebuild indexes, etc.? If not, SQL Server may still be building its query plans on your older statistics of smaller tables.
SQL Server generates parallel query plans automatically, if certain conditions are met. From an article on MSDN:
Other factors:
Is SQL Server configured to have affinity to a single processor?
Is the max degree of parallelism option is set to 1?
— EDIT —
Have you tried profiling this process? It would be interesting to see the query plan SQL Server generates.
Do you have sample code you can post?
If you have an automated nightly backup job, can you simply restore the backup to the archive?