Ver Mensaje Individual
  #9 (permalink)  
Antiguo 04/09/2012, 14:40
ericklanford
 
Fecha de Ingreso: diciembre-2011
Mensajes: 77
Antigüedad: 12 años, 4 meses
Puntos: 2
Respuesta: Top1 Vs all data. q debería ser más rápido

Efectivamente Libras, ya revisé el plan de ejecución, de hecho lo comentaba en el post anterior.

El tema es:
ya sé q SQL ejecuta más rápido esta consulta:

select top 1 * from
(SELECT * FROM Tabla
where
Col1='XXX' and Col2 = 'XXXXXXXX'
) A
order by Fecha desc


sin embargo, esta otra devuelve el mismo resultado y se demora mucho más:

SELECT TOP 1 *
FROM Tabla
where
Col1='XXX' and Col2 = 'XXXXXXXXX'
order by Fecha desc


COMO PUEDE SER POSIBLE ESTO?