Whether the Oracle query records are efficient or not.
Recently, we need to optimize the efficiency of the Oracle database, and then check a lot of efficient methods on the Internet to determine whether the record exists.
There are many suggestions for the first method on the Internet. I did a test, but the data volume may not be large enough, with 42667 records. I don't know what a large data volume is.
Many efficient recommendations on the Internet
Select * from item where item = '1b241371x0021 'and rownum <2;
But my test results:
Select * from item where item = '1b241371x0021 'and rownum <2;
1 rows selected in 0.047 seconds
Count (*) Method
Select count (*) from item where item = '1b241371x0021 ';
1 rows selected in 0.016 seconds
Exists Method
Select count (*) from dual where exists (select 1 from item where item = '1b241371x0021 ');
1 rows selected in 0.015 seconds
From the test results, the efficiency of the last two methods is significantly higher than that of the previous method.