daelmo wrote:
Could you show the code that generates the query?
LinqMetaData metaData = new LinqMetaData(adapter);
var q = (from cm in metaData.ContractMaster
select cm)
.WithPath(p => p.Prefetch(cm => cm.ContractDetail))
.WithPath(p => p.Prefetch(cm => cm.CustMaster));
if (!string.IsNullOrEmpty(dealerId))
{
q = q.Where(all => all.DealerId == dealerId);
}
if (!string.IsNullOrEmpty(lastName))
{
q = q.Where(all => all.CustMaster.LastName == lastName);
}
daelmo wrote:
How much performance do you gain using the query without parameters?
I'll have to see. The difference is significant.
One thing that I just noticed is that if I copy the query I see (via Profiler) LLBL execute into a SQL Management instance, the query executes fine.
I'm not sure if this is what was happening when my DBA investigated, but, again, I'll check and get back to you.
Offhand, do you know any reason why the same query executed interactively and via LLBL would have two wildly different completion times? (I executed the one in Management Studio first, so if there's any caching benefit, it should have been seen by the LLBL-based query.)
Thanks!
EDIT: I verified the queries that I'm seeing in Profiler are identical.