Non-clustered index taking time on cetain days

ACDBA 416 Reputation points
2021-12-03T11:35:56.113+00:00

I have a non-clustered index created every day on a partitioned table of 90million records..Usually, it takes 5 min to complete. but on some days it takes 3 to 4 hours. No other activity is running on the server at that time and nothing is blocking this creation. I can see a spike in CPU\Memory usage during this window.

Can you advise what to check? data volume is almost the same.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,814 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,559 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tom Phillips 17,716 Reputation points
    2021-12-03T13:31:37.7+00:00

    Are you running on a virtual machine? My first guess would be yes. I would suggest you look at the host usage, not the VM instance usage. It is likely something else on the host is interfering with the SQL VM.