I have a large dynamic query that is causing huge performance problems in our database. It looks like we're running into the "parameter sniffing" issue where using sp_executesql is causing cached execution plans to used, or a full table scan is happening vs. using the indexes that are defined in place.
In this thread:
http://llblgen.com/tinyforum/GotoMessage.aspx?MessageID=95391&ThreadID=13271
the author came up with a way to rewrite the fetch query such that the parameters were defined first, then executed the sql. However, this was done using Adapter.
Using SelfServicing, how could I achieve the same result where the SQL to be executed would be retrieved to be "reorganized" to avoid this behavior?
I tried to inherit from my base collection class (in this case PositionUsersCollection) but I could not override the UpdateMulti method.
Any thoughts on a direction for this?
EDIT:
LLBLGen 2.6
SQL 2005