I have the next query:
SELECT to_char(xa_time_cnv.utc_to_loc(UTCTIME),'DD-MM-YYYY HH24:MI:SS'),
+
ROUND(VALOR_INST,2),
+
ge_pkt_conv_funcs.f_convert_tlq(TLQ_INST),
+
ROUND(VALOR_PROM,2), +
ge_pkt_conv_funcs.f_convert_tlq(TLQ_PROM),
+
ROUND(VALOR_MAX,2), +
ge_pkt_conv_funcs.f_convert_tlq(TLQ_MAX),
+
to_char(xa_time_cnv.utc_to_loc(UTCTIME_MAX),'DD-MM-YYYY HH24:MI:SS'),
+
ROUND(VALOR_MIN,2),
+
ge_pkt_conv_funcs.f_convert_tlq(TLQ_MIN),
+
to_char(xa_time_cnv.utc_to_loc(UTCTIME_MIN),'DD-MM-YYYY HH24:MI:SS')
FROM a_5min_033
WHERE utctime >= xa_time_cnv.loc_to_utc(TO_DATE('27/06/2014 00:00:00','DD-MM-YYYY HH24:MI:SS'),null)
AND utctime <= xa_time_cnv.loc_to_utc(TO_DATE('28/06/2014 00:00:00','DD-MM-YYYY HH24:MI:SS') + 8/24,null)
AND POINTNUMBER = 330000
ORDER BY utctime;
The first time it runs after returns records:
Elapsed: 00:00:30.87
Then, In a second run (query in cache):
Elapsed: 00:00:01.17
I tried grouping, but without results:
GROUP BY utctime, valor_inst, tlq_inst, valor_prom, tlq_prom, valor_max, tlq_max, utctime_max, valor_min, tlq_min, utctime_min
a_5min_033 have 3million of rows, aprox.
I would like to improve the response, 1st time.
Could you advise me on how to get better performance?
In the attachment, I send the script of creating the table, indexes.
POINTNUMBERandutctime? Depending on cardinalities this might result in better performance. Is your query much faster if you omit theORDER BY?