En base al profiler del propio Evolution a continuacion pongo el query que se ejecuta para enlistar las autorizaciones pendientes. Revisalo y tal vez se pueda optimizar la base con un indice o algun otro tipo de solucion
SELECT
[Project3].[ain_codigo] AS [ain_codigo],
[Project3].[ain_nombre] AS [ain_nombre],
[Project3].[ain_tipo_autorizador] AS [ain_tipo_autorizador],
[Project3].[ain_num_record_escalar] AS [ain_num_record_escalar],
[Project3].[ain_minutos_recordatorio] AS [ain_minutos_recordatorio],
[Project3].[ain_estado] AS [ain_estado],
[Project3].[ain_usuario_procesa] AS [ain_usuario_procesa],
[Project3].[ain_fecha_procesa] AS [ain_fecha_procesa],
[Project3].[ain_orden] AS [ain_orden],
[Project3].[ain_usuario_grabacion] AS [ain_usuario_grabacion],
[Project3].[ain_fecha_grabacion] AS [ain_fecha_grabacion],
[Project3].[ain_usuario_modificacion] AS [ain_usuario_modificacion],
[Project3].[ain_fecha_modificacion] AS [ain_fecha_modificacion],
[Project3].[ain_fecha_pendiente] AS [ain_fecha_pendiente],
[Project3].[ain_fecha_notificado] AS [ain_fecha_notificado],
[Project3].[ain_fecha_autorizado] AS [ain_fecha_autorizado],
[Project3].[ain_fecha_denegado] AS [ain_fecha_denegado],
[Project3].[ain_fecha_anulado] AS [ain_fecha_anulado],
[Project3].[ain_comentarios] AS [ain_comentarios],
[Project3].[ain_actividad_revision] AS [ain_actividad_revision],
[Project3].[ain_chequea_aut_act_ant] AS [ain_chequea_aut_act_ant],
[Project3].[ain_acepta_aut_sustitutos] AS [ain_acepta_aut_sustitutos],
[Project3].[ain_codemp_procesa] AS [ain_codemp_procesa],
[Project3].[ain_coddar] AS [ain_coddar],
[Project3].[ain_codira] AS [ain_codira],
[Project3].[ain_codain_destino_denegar] AS [ain_codain_destino_denegar],
[Project3].[ain_codain_reintenta] AS [ain_codain_reintenta],
[Project3].[ain_es_requerida] AS [ain_es_requerida],
[Project3].[ain_ignora_vacantes_jerarquia] AS [ain_ignora_vacantes_jerarquia],
[Project3].[ain_permitir_aut_suj_acc] AS [ain_permitir_aut_suj_acc]
FROM ( SELECT
[Extent1].[ain_codigo] AS [ain_codigo],
[Extent1].[ain_codira] AS [ain_codira],
[Extent1].[ain_coddar] AS [ain_coddar],
[Extent1].[ain_codain_destino_denegar] AS [ain_codain_destino_denegar],
[Extent1].[ain_codain_reintenta] AS [ain_codain_reintenta],
[Extent1].[ain_nombre] AS [ain_nombre],
[Extent1].[ain_tipo_autorizador] AS [ain_tipo_autorizador],
[Extent1].[ain_num_record_escalar] AS [ain_num_record_escalar],
[Extent1].[ain_minutos_recordatorio] AS [ain_minutos_recordatorio],
[Extent1].[ain_estado] AS [ain_estado],
[Extent1].[ain_usuario_procesa] AS [ain_usuario_procesa],
[Extent1].[ain_fecha_procesa] AS [ain_fecha_procesa],
[Extent1].[ain_codemp_procesa] AS [ain_codemp_procesa],
[Extent1].[ain_orden] AS [ain_orden],
[Extent1].[ain_fecha_pendiente] AS [ain_fecha_pendiente],
[Extent1].[ain_fecha_notificado] AS [ain_fecha_notificado],
[Extent1].[ain_fecha_autorizado] AS [ain_fecha_autorizado],
[Extent1].[ain_fecha_denegado] AS [ain_fecha_denegado],
[Extent1].[ain_fecha_anulado] AS [ain_fecha_anulado],
[Extent1].[ain_comentarios] AS [ain_comentarios],
[Extent1].[ain_actividad_revision] AS [ain_actividad_revision],
[Extent1].[ain_chequea_aut_act_ant] AS [ain_chequea_aut_act_ant],
[Extent1].[ain_acepta_aut_sustitutos] AS [ain_acepta_aut_sustitutos],
[Extent1].[ain_es_requerida] AS [ain_es_requerida],
[Extent1].[ain_ignora_vacantes_jerarquia] AS [ain_ignora_vacantes_jerarquia],
[Extent1].[ain_permitir_aut_suj_acc] AS [ain_permitir_aut_suj_acc],
[Extent1].[ain_usuario_grabacion] AS [ain_usuario_grabacion],
[Extent1].[ain_fecha_grabacion] AS [ain_fecha_grabacion],
[Extent1].[ain_usuario_modificacion] AS [ain_usuario_modificacion],
[Extent1].[ain_fecha_modificacion] AS [ain_fecha_modificacion]
FROM [wfl].[ain_actividades_instancia] AS [Extent1]
WHERE (( EXISTS (SELECT
1 AS [C1]
FROM [wfl].[dra_det_responsables_act_inst] AS [Extent2]
INNER JOIN [exp].[emp_empleos] AS [Extent3] ON [Extent2].[dra_codemp] = [Extent3].[emp_codigo]
WHERE ([Extent1].[ain_codigo] = [Extent2].[dra_codain]) AND ([Extent3].[emp_codexp] = xxx)
)) OR (([Extent1].[ain_acepta_aut_sustitutos] = 1) AND ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT [Extent4].[dra_codain] AS [dra_codain], [Extent5].[esu_codemp_sustituto] AS [esu_codemp_sustituto]
FROM [wfl].[dra_det_responsables_act_inst] AS [Extent4]
INNER JOIN [wfl].[esu_empleos_sustitutos] AS [Extent5] ON [Extent4].[dra_codemp] = [Extent5].[esu_codemp_titular]
WHERE ([Extent5].[esu_fecha_inicio] <= convert(datetime2, '2019-08-12 00:00:00.0000000', 121)) AND ([Extent5].[esu_fecha_fin] >= convert(datetime2, '2019-08-12 00:00:00.0000000', 121)) ) AS [Filter2]
INNER JOIN [exp].[emp_empleos] AS [Extent6] ON [Filter2].[esu_codemp_sustituto] = [Extent6].[emp_codigo]
WHERE ([Extent1].[ain_codigo] = [Filter2].[dra_codain]) AND ([Extent6].[emp_codexp] = xxx)
)))) AND ([Extent1].[ain_estado] = 'Notificado')
) AS [Project3]
ORDER BY [Project3].[ain_fecha_notificado] DESC
answered
12 Aug '19, 10:24
sbarahona ♦♦
(suspended)
accept rate:
32%