Home > database > About Oracle implementation effect of the same field limiting twice
About Oracle implementation effect of the same field limiting twice
Time:09-19
Oracle10g, accidental discovery, after the restriction on the same field twice in the where cost is lower, perform faster, such as a query Where in_date & gt;=sysdate - 300, Cost more than 1000, if use two Where in_date & gt;=sysdate - 300 And in_date & gt;=sysdate - 310 It cost only a few hundred, query time is less than the above, this is what reason ah (ps, this field has join index)
CodePudding user response:
Look at the execution plan
CodePudding user response:
There is only one in_date & gt; Don't go=sysdate - 300, the index, a full table scan, add a and in_date & gt;=go after sysdate - 310 index
CodePudding user response:
Just write in_date & gt;=sysdate - 310, to see what execution plan,
CodePudding user response:
Look at the in_date & gt;=sysdate - 300 and in_date & gt;=sysdate - 310 record of how much is the percent of total record number respectively?