This code took 1 minute and 25 seconds:
Code: Select all
var w1 = ctx.DadoObjetos
.Where(q => q.CdTipoRegistro == "JDS" && q.DtGeracao >= DtInicio && q.DtGeracao new { q.CdLPAR, q.CdObjeto });
result.Count = w1.Count();
Code: Select all
SELECT "GroupBy1".a1 AS c1
FROM (
SELECT COUNT (1) AS a1
FROM (
SELECT DISTINCT
"Extent1".lpar_cd AS lpar_cd,
"Extent1".os_cd AS os_cd
FROM scdrd.dado_obj "Extent1"
WHERE (("Extent1".do_tp_reg = 'JDS')
AND ("Extent1".do_dta_gera_reg >= :p__linq__0))
AND ("Extent1".do_dta_gera_reg < :p__linq__1)
) "Distinct1"
) "GroupBy1"
Do you have any suggestion?
Best regards,
Henrique