I have a CreateSQLQuery that runs in under a minute in MS Studio but in the C# program it times out after 20 minutes.
In looking at the SQL Server Profiler I see the last exe sp_executesql for the last executed SQL command followed by another Audit Login and then it waits until it times out (or if the timeout is long I get multiple Audit logouts).
I write the SQL out to the log so I can see what SQL it is working on, but It does not show up in the profiler.
I suspect that it is having trouble optimizing the query, maybe not using indexes or some other problem
Does this sound familiar? are there things I can do to find out what the problem is? or if a know problem are there work arounds.
The query had multple inner joins followed by multiple out joins. It is using CreateSQLQuery on a MS SQL 2005 DB and using NHib 3.2
Thanks,
|