I have a question about Oracle Database (9i).
There are two simple queries:
select * from t3_main where data <= trunc(sysdate-112) and data >= trunc(sysdate-112);
select * from t3_main where data = trunc(sysdate-112);
First of this queries parsed for nearly 1 second and executes for nearly 1 second
Second query, as you see? provide the same result, but parsed for nearly 13 seconds, and executes for nearly 1 second.
Yes, FIRST query need much less time for parsing, and the second query run after the first.
On more complex queries parsing time of second type query dramatically increased (in real system 1.3 second for first query and 30 minutes for parsing second query).
t3_main - medium size, partitioned by date on daily basis table.
Execution plans for queries respectively:
1)
SELECT STATEMENT Optimizer=CHOOSE (Cost=4746 Card=14480 Bytes=2896000)
FILTER
PARTITION RANGE (ITERATOR)
TABLE ACCESS (FULL) OF T3_MAIN (Cost=4746 Card=14480 Bytes=2896000)
2)
SELECT STATEMENT Optimizer=CHOOSE (Cost=8 Card=5965 Bytes=512990)
PARTITION RANGE (SINGLE)
TABLE ACCESS (FULL) OF T3_MAIN (Cost=8 Card=5965 Bytes=512990)
Yes Cost optimization is impressible.
Question: "is it bug, feature or..." - why so hard parsing and how can I avoid it, because for hours parsing for complex join queries.
With respect, Arsen Kroptya.
There are two simple queries:
select * from t3_main where data <= trunc(sysdate-112) and data >= trunc(sysdate-112);
select * from t3_main where data = trunc(sysdate-112);
First of this queries parsed for nearly 1 second and executes for nearly 1 second
Second query, as you see? provide the same result, but parsed for nearly 13 seconds, and executes for nearly 1 second.
Yes, FIRST query need much less time for parsing, and the second query run after the first.
On more complex queries parsing time of second type query dramatically increased (in real system 1.3 second for first query and 30 minutes for parsing second query).
t3_main - medium size, partitioned by date on daily basis table.
Execution plans for queries respectively:
1)
SELECT STATEMENT Optimizer=CHOOSE (Cost=4746 Card=14480 Bytes=2896000)
FILTER
PARTITION RANGE (ITERATOR)
TABLE ACCESS (FULL) OF T3_MAIN (Cost=4746 Card=14480 Bytes=2896000)
2)
SELECT STATEMENT Optimizer=CHOOSE (Cost=8 Card=5965 Bytes=512990)
PARTITION RANGE (SINGLE)
TABLE ACCESS (FULL) OF T3_MAIN (Cost=8 Card=5965 Bytes=512990)
Yes Cost optimization is impressible.
Question: "is it bug, feature or..." - why so hard parsing and how can I avoid it, because for hours parsing for complex join queries.
With respect, Arsen Kroptya.