saludos amigos de foros del web.
nuevamente requiero de su ayuda, en esta ocacion para optimizar una consulta que demora alrededor de 15 minutos es ejecutarce y entenderan que no es un tiempo aceptable de espera para el usuario.
lo que hace mi consulta es generar una especie de pivot table(tabla horizontal) con ciertos datos filtrados por fecha y devuelve algo asi:
|DIA 1|DIA 2|DIA3|DIA4|DIA5| DIA6| Dia7 |
ciclo 1 | 234 | 520 | 534 | 800 | 923 | 234 | 298 |
ciclo 2 | 234 | 520 | 534 | 800 | 923 | 234 | 298 |
ciclo 3 | 234 | 520 | 534 | 800 | 923 | 234 | 298 |
ciclo 4 | 234 | 520 | 534 | 800 | 923 | 234 | 298 |
ciclo 5 | 234 | 520 | 534 | 800 | 923 | 234 | 298 |
y la consulta es
Código MySQL:
Ver original from ces_ivr_reporte_comercial
, ces_ivr_eventos
where RUT_CUENTA
=RUT
and ABREV_EVENTO
='comercial' where NMRO_CICLO
=t2.NMRO_CICLO
from ces_ivr_reporte_comercial
, ces_ivr_eventos
where RUT_CUENTA
=RUT
and ABREV_EVENTO
='comercial' where NMRO_CICLO
=t2.NMRO_CICLO
from ces_ivr_reporte_comercial
, ces_ivr_eventos
where RUT_CUENTA
=RUT
and ABREV_EVENTO
='comercial' where NMRO_CICLO
=t2.NMRO_CICLO
from ces_ivr_reporte_comercial
, ces_ivr_eventos
where RUT_CUENTA
=RUT
and ABREV_EVENTO
='comercial' where NMRO_CICLO
=t2.NMRO_CICLO
from ces_ivr_reporte_comercial
, ces_ivr_eventos
where RUT_CUENTA
=RUT
and ABREV_EVENTO
='comercial' where NMRO_CICLO
=t2.NMRO_CICLO
from ces_ivr_reporte_comercial
, ces_ivr_eventos
where RUT_CUENTA
=RUT
and ABREV_EVENTO
='comercial' where NMRO_CICLO
=t2.NMRO_CICLO
from ces_ivr_reporte_comercial
, ces_ivr_eventos
where RUT_CUENTA
=RUT
and ABREV_EVENTO
='comercial' where NMRO_CICLO
=t2.NMRO_CICLO
select NMRO_CICLO
,NMRO_CUENTA
,RUT_CUENTA
, from ces_ivr_reporte_comercial
where ABREV_EVENTO
='comercial'
nose si me pueden ayudar a optimizarla para que se reduzca el tiempo de ejecucion de la consulta. de antemano muchas gracias.