Pessoal, tenho a seguinte query abaixo, e está leeenta demais.. gostaria de sugestões para melhorar.
Declare @central as int
Declare @dt_inicio as smalldatetime
Declare @dt_fim as smalldatetime
Set @central = 21
Set @dt_inicio = '2006-09-01'
Set @dt_fim = '2006-09-30'
select Count(*),Sum(duracao)/60 from ligacoes_particoes where right(nrdiscado,8)
in
(select faixa from voip_numeros where pkcdcentral in (14) )
and pkcdcentral = @central and dtligacao Between @dt_inicio and @dt_fim and sigla <> 'ENT'
and duracao > 10 and Len(nrdiscado) <= 13
and pkcdrota not in (select pkcdrota from voip_rota where pkcdcentral = @central)
Abraço,