Answer the question
In order to leave comments, you need to log in
Slow Prepared statement on Oracle
Colleagues,
There is the following sql query that selects 20 records sorted by date and transaction:
select rd from( select /*+ INDEX(OUT_SMS OUT_SMS_CREATE_TS_TRX_ID_IX) */ rowid rd from OUT_SMS where TRX_ID between 34621422135410688 and 72339069014638591 and CREATE_TS between to_timestamp('2013-02-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and to_timestamp('2013-03-06 08:57:00', 'yyyy-mm-dd hh24:mi:ss') order by CREATE_TS DESC, TRX_ID DESC ) where rownum <= 20
select rd from( select /*+ INDEX(OUT_SMS OUT_SMS_CREATE_TS_TRX_ID_IX) */ rowid rd from OUT_SMS where TRX_ID between ? and? and CREATE_TS between ? and? order by CREATE_TS DESC, TRX_ID DESC ) where rownum <= 20
Answer the question
In order to leave comments, you need to log in
It is not clear, by the way, where does the estimate of 312 million lines come from in the first plan, if there are only 48 partitions and 20 lines from each.
In general, it is not news that a plan with literal variables is usually slightly (or even slightly) more productive than with bind variables.
You are here to look in the direction of fixing the plan, probably.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question