select table_name from test where table_name='DBMS_ALERT_INFO' or table_name ='DBMS_APPS_UPG_WORKING';
执行计划
----------------------------------------------------------
Plan hash value: 2019477598
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 12 | 204 | 3 (0)| 00:00:01 |
| 1 | INLIST ITERATOR | | | | | |
|* 2 | INDEX RANGE SCAN| IDX_TEST_TBNAME | 12 | 204 | 3 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("TABLE_NAME"='DBMS_ALERT_INFO' OR
"TABLE_NAME"='DBMS_APPS_UPG_WORKING')
Note
-----
- dynamic sampling used for this statement
统计信息
----------------------------------------------------------
5 recursive calls
0 db block gets
81 consistent gets
0 physical reads
0 redo size
546 bytes sent via SQL*Net to client
385 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
14 rows processed
select table_name from test where table_name in ('DBMS_ALERT_INFO','DBMS_APPS_UPG_WORKING');
执行计划
----------------------------------------------------------
Plan hash value: 2019477598
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 12 | 204 | 3 (0)| 00:00:01 |
| 1 | INLIST ITERATOR | | | | | |
|* 2 | INDEX RANGE SCAN| IDX_TEST_TBNAME | 12 | 204 | 3 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("TABLE_NAME"='DBMS_ALERT_INFO' OR
"TABLE_NAME"='DBMS_APPS_UPG_WORKING')
Note
-----
- dynamic sampling used for this statement
统计信息
----------------------------------------------------------
4 recursive calls
0 db block gets
81 consistent gets
0 physical reads
0 redo size
546 bytes sent via SQL*Net to client
385 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
14 rows processed
结论:
(1)都会使用索引。
(2)用 in 少一个递归调用!
记得以后尽量用in!