Hi,
In our customer's environment, Save, Find operations from the Web Applications takes 2 seconds to 2 minutes.
There are number of SQL statements fired before the actual Save (PreSave) using some rules.
When we analyzed the SQL server trace files, we found very simple queries taking more than 15+ seconds (Duration column in trace).
If I run that query using SSMS, it will fetch results in a fraction of seconds. Query has awhere clause which is on Primay Key (clustered index) and that doesn't seems to be an issue.
Here is the query which is getting fired. It is opening a recordset with adOpenStatic, adLockOptimistic as Cursor type and Lock type.
declare @p1 int set @p1=180150749 declare @p3 int set @p3=4 declare @p4 int set @p4=1 declare @p5 int set @p5=-1 exec sp_cursoropen @p1 output,N'SELECT (SELECT Field1 FROM _owner_.Table where "Number #" = ''intValue1') AS MYRETURN FROM DUAL',@p3 output,@p4 output,@p5 output select @p1, @p3, @p4, @p5
We are using such statements heavily where Field1 and intValue1 will change. (We cannot convert this to SP though)
SQL server (SQL 2008 R2 64 bit, 8 CPU, 23 GB RAM) has around 40 to 70% processor utilization.
What might be causing this? What else I can look for?
Regards
Rahul