I have a MS SQL query that takes about 40 seconds to run in ASP.NET (EF Linq). I have captured it in Profiler and it shows a duration of about 40 seconds:
However, when I copy/paste this in SQL Management Studio it runs in 00:00:00 seconds. It's a simple select
on a single table (no Joins, Views, Stored Procedure) and it returns about 10.000 rows.
Execution plan:
I read this question on StackOverflow witch points to this blog and placed
SET ARITHABORT OFF
above the query in Management Studio but that doesn't make it slow so I don't think that is the issue.
One strange thing is that we migrated the application to a faster server with Windows 2012 / SQL 2014 Web Edition and since that time queries seems to run slower. The same query did run a lot faster on our old Windows 2008R2 Server with SQL Express 2008R2.