i have doubt in query it's little bit slow , want know what's best performance.
let's present first example:
var result = tablea in context.tablea join tableb in context.tableb on tablea.id equals tableb.id *some conditions* select new { tablea.id, tablea.name, another_name = tablea.tablec.name some_operation = tableb.price * tableb.tabled.some_coeficient another_operation = tableb.tablee.sum(c=> c.some_value) }; this have right (after query perform in variable result.tolist().
mi question if better in levels of performance make:
- a query lambda expressions? keeping
select new {....}part. - a query
select new {....}part aftertolist()?
what recommend me do?
it same. query expressions converted non-query-expression equivalent.
you'd need use
select new { tablea, tableb }or similar anyway, use both variables aftertolist... slower then:- all fields pulled database rather used
- the projections (including sum etc) happen after fetching values database, rather within database. involve making more database requests, access
tablea.tablecetc.
you should @ generated sql, run in sql profiler work out what's slow, consider more indexes etc.
Comments
Post a Comment