He agregado hints INDEX para forzar el uso del índice:
Código SQL:
Ver originalSELECT
COL_A,
COL_B,
COL_C,
S_TIMESTAMP
FROM DM.CDR_GPRS PARTITION(P_20140618)
WHERE
S_TIMESTAMP > TO_DATE('20140616205959', 'YYYYMMDDHH24MISS')
UNION
SELECT /*+ INDEX(B IDX_GPRS_S_TIMESTAMP) */
COL_A,
COL_B,
COL_C,
S_TIMESTAMP
FROM DM.CDR_GPRS PARTITION(P_20140619 ) B
UNION
SELECT /*+ INDEX(C IDX_GPRS_S_TIMESTAMP) */
COL_A,
COL_B,
COL_C,
S_TIMESTAMP
FROM DM.CDR_GPRS PARTITION(P_20140620 ) C
UNION
SELECT /*+ INDEX(D IDX_GPRS_S_TIMESTAMP) */
COL_A,
COL_B,
COL_C,
S_TIMESTAMP
FROM DM.CDR_GPRS PARTITION(P_20140621 ) D
UNION
SELECT /*+ INDEX(E IDX_GPRS_S_TIMESTAMP) */
COL_A,
COL_B,
COL_C,
S_TIMESTAMP
FROM DM.CDR_GPRS PARTITION(P_20140622) E
WHERE
S_TIMESTAMP <= TO_DATE('20140620205959', 'YYYYMMDDHH24MISS')
Y con esto ya no muestra los Table Access Full, pero noto que el costo se ha incrementado considerablemente:
https://www.dropbox.com/s/1ochfc9jvb...t01-1.png?dl=0
No estoy seguro si es buena usar hints en esta consulta, si me confirman.
Muchas gracias, saludos.