Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/05/2009, 11:03
garruc
 
Fecha de Ingreso: junio-2007
Mensajes: 28
Antigüedad: 17 años
Puntos: 0
Respuesta: table scan/index seek en procedimiento

ahí os envío la consulta por si os sirve de algo
"@facturas_ventas" es una variable tipo tabla, el resto son variables del procedimiento

insert into @facturas_ventas
select distinct f.id, f.total, f.descuento,f.descuento2,f.descuento3, @cta_recargo_ventas, f.totalre, @ctairpf, f.totalirpf, cli.re, f.divisa,1
from dbo.facturas f with(index (PK_FAC),nolock )
inner join caja c with(index(IX_CAJA_CAJA_FECHA_TANOTACION),nolock) on
c.id=@caja
and c.fecha >= @fecha_ant
and c.fecha <= @fecha_post
and c.tanotacion='ENTRADA'
and c.tdoc='FACTURA'
and f.id=c.ndoc
inner join dbo.clientes cli with(index(PK_CLIENTES),nolock) on and cli.ncliente = f.ncliente
where
and f.serie=@serief
and f.contabilizado=isnull(@conta,f.contabilizado)