Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/11/2011, 08:40
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 8 meses
Puntos: 774
Respuesta: Problema con consulta SQL Lenta en seccion IN

ya revisaste los indices de tus tablas?? ya revisaste el plan de ejecucion (ctrl+L en sql server)???

Prueba con esto

set statistics io on;
SELECT D.CSU
FROM dbo.VW_USUA_CONTRATOS AS A
INNER JOIN dbo.VW_CONT_REC B ON A.ID_CONTRATO=B.ID_CONTRATO
INNER JOIN dbo.VW_PROYECTOS_EJECUCION D ON A.ID_CONTRATO=D.ID_CONTRATO
INNER JOIN dbo.VW_PLANEACION_HABILITA_POT_GENERAL E ON D.CSU=E.CSU
WHERE A.ID_USUARIO=1 AND A.ID_CONTRATO=184 AND
D.ID_ESTADO IN(1,2)AND D.ID_SUBPROYECTO=0 AND E.VIGENTE=1 and e.anio=2011 and d.csu in(253112513,253112514,253112515,253112516)
ORDER BY D.CSU asc

set statistics io off;


y publica lo que te regresa ese query :)

Saludos!
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me