Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/12/2006, 11:07
k3n
 
Fecha de Ingreso: marzo-2006
Mensajes: 56
Antigüedad: 18 años, 2 meses
Puntos: 0
Problema con UNION; genera demora en exceso

Holas. Tengo el siguiente Query:

SELECT
t.label, u.vnousr || ' ' || u.vappat as client,
a.vdeare, t.starttime, t.endtime,' ' as summary,
'LOG' as Tabla ,
'Terminado' as situacion ,
t.incident as incid ,
' ' as TipoInc,
t.incident as incidente
FROM
workflow.log_workflow t, workflow.usr u, workflow.are a
WHERE
t.ccoexp = '2005034139' AND
trim(t.client) = trim(u.user_nt) and
t.label <> 'Seleccion' AND
u.ccoare = a.ccoare
union

SELECT s.label, u.vnousr || ' ' || u.vappat as client, a.vdeare, s.starttime, s.endtime, s.summary as summary, 'STEP' as Tabla ,
DECODE(s.status,'1','Activo', 'Terminado') AS SITUACION, s.incident as incid ,
decode( instr(nvl(s.summary,'X'), 'SubFlujo'),0, 'Principal' , 'SubFlujo') as TipoInc, s.incident as incidente
FROM ultimus.data_adm_doc@dbl_fornax t , workflow.usr u,workflow.are a, ultimus.step@dbl_fornax s
WHERE t.ccoexp = '2005034139'
and t.name = s.name and t.incident = s.incident
and s.name in ( select name from ultimus.data_adm_doc@dbl_fornax da where da.ccoexp = '2005034139')
and s.label <> 'Seleccion'
AND s.incident in ( select incident from ultimus.data_adm_doc@dbl_fornax da where da.ccoexp = '2005034139')
AND trim(s.client) = trim(u.user_nt)
AND u.ccoare = a.ccoare
ORDER BY 4 Desc

Las consulta antes y después del union, funcionan normalmente y demoran a lo máximo tres segundos. Cuando funcionan juntos, han llegado a demorar 550 segundos en realizar la búsqueda. ¿Qué puede producir que el UNION genere tal demora?