SQL - Optimizacion de Consultas

 
Vista:
sin imagen de perfil
Val: 1
Ha disminuido su posición en 62 puestos en SQL (en relación al último mes)
Gráfica de SQL

Optimizacion de Consultas

Publicado por Alexander (1 intervención) el 16/05/2018 00:40:01
Hola, tengo varias consultas con la misma estructura que deseo optimizar, por lo que entiendo se esta jalando una informacion y en una tabla temporal se traba.
Las consultas tienen la misma estructura, en el plan de ejecucion me figura que todas tienen un RID lookup, he leido pero no entiendo muy bien que tendria que hacer, el managment me sugiere hacer un indice pero lo veo poco eficiente al implementarlo.

-- GENERACION DE TABLA NOMINAL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
with constante (id_cita, renaes, id_persona, periodo, fichafam, ubigeo, edad, tip_edad, SEXO, ET, FI, id_profesional, Evaluacion)
as
(
select id_cita, renaes, id_persona, periodo, fichafam, ubigeo, edad_reg EDAD,
id_tipedad_reg TIP_EDAD, id_genero SEXO, id_etnia ET, id_financiador FI, id_profesional,
Evaluacion =
case
    when id_tipitem='D' and cod_item='E669' and valor_lab='IMC' then 1
    when id_tipitem='D' and cod_item='E660' and valor_lab='IMC' then 2
    when id_tipitem='D' and cod_item='Z006' and valor_lab='IMC' then 3
    when id_tipitem='D' and cod_item='E440' and valor_lab='IMC' then 4
    when id_tipitem='D' and cod_item='E43X' and valor_lab='IMC' then 5
    when id_tipitem='D' and cod_item='E344' and valor_lab='TE' then 6
    when id_tipitem='D' and cod_item='Z006' and valor_lab='TE' then 7
    when id_tipitem='D' and cod_item='E45X' and valor_lab='TE' then 8
 
end from [dbo].[TRAMAHIS_DTSG] where (id_tipedad_reg='A' and edad_reg between 18 and 29)
)
select id_cita, renaes, id_persona, periodo, fichafam, ubigeo, edad, tip_edad, SEXO, ET, FI, id_profesional,	Evaluacion
into TRAMA_BASE_JOVEN_RPT_02_EVAL_NUTRIC_NOMINAL from constante where (Evaluacion between 1 and 8);

Quisiera saber que me recomiendan para poder optimizar

Gracias!!!!!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder