【提示】filter 與access 的區別
filter 與 access 的區別
filter 是過濾資料,access 是選擇表的訪問路徑。
SQL> create table t1 (x int,y int);
表已建立。
SQL> set autotrace trace exp;
SQL> select /*+ rule */ * from t1 where x=5;
已用時間: 00: 00: 00.00
執行計劃
----------------------------------------------------------
Plan hash value: 3617692013
----------------------------------
| Id | Operation | Name |
----------------------------------
| 0 | SELECT STATEMENT | |
|* 1 | TABLE ACCESS FULL| T1 |
----------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("X"=5) --表t1 沒有建立索引,此時不可能走索引,filter起到過濾資料的作用。
Note
-----
- rule based optimizer used (consider using cbo)
SQL> select * from t1 where x=5;
已用時間: 00: 00: 00.01
執行計劃
----------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 26 | 2 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 1 | 26 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("X"=5)
Note
-----
- dynamic sampling used for this statement
已用時間: 00: 00: 12.01
SQL> create table t1 ( x int , y int);
表已建立。
已用時間: 00: 00: 00.53
SQL> set autot trace exp
SQL> select * from t1 where x =5;
已用時間: 00: 00: 00.06
執行計劃
----------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 26 | 2 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 1 | 26 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("X"=5)
Note
-----
- dynamic sampling used for this statement
SQL> create index idx_t on t1(x,y);
索引已建立。
SQL> select * from t1 where x =5;
執行計劃
----------------------------------------------------------
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 26 | 2 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T1 | 1 | 26 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
--------------------------------------------------
1 - filter("X"=5)
Note
-----
- dynamic sampling used for this statement
SQL> select /*+ rule */ * from t1 where x=5;
已用時間: 00: 00: 00.01
執行計劃
----------------------------------------------------------
Plan hash value: 2296882198
----------------------------------
| Id | Operation | Name |
----------------------------------
| 0 | SELECT STATEMENT | |
|* 1 | INDEX RANGE SCAN| IDX_T |
----------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("X"=5) --這次謂詞影響到資料的訪問路徑選擇索引。
Note
-----
- rule based optimizer used (consider using cbo)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-676314/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Filter 與 Servlet 的區別FilterServlet
- filter和interceptor的區別Filter
- 過濾器 Filter 與 攔截器 Interceptor 的區別過濾器Filter
- fs.exists 與 fs.access的區別是什麼
- Spring中Filter和Interceptor的區別SpringFilter
- has(),find()以及filter()方法的區別Filter
- SQLAlchemy中filter()和filter_by()有什麼區別SQLFilter
- access_token和refresh_token的區別
- Python和access的區別有哪些?Python教程Python
- python3和python2中的filter區別PythonFilter
- ??與?:的區別
- 微信網頁授權之access_token和refreshtoken區別與聯絡網頁
- ODataListBinding.filter 方法裡 FilterType.Application 和 Control 的區別FilterAPP
- ES 23 - 檢索和過濾的區別 (query vs. filter)Filter
- session與cookie的區別SessionCookie
- @Valid 與 @Validated 的區別
- Eureka與Zookeeper的區別
- async與defer的區別
- print 與 println 的區別
- buffer與cache的區別
- grid 與 treelist 的區別
- Python中 ‘==‘ 與‘is‘的區別Python
- http與https的區別HTTP
- GET 與 POST 的區別
- TCP與UDP的區別TCPUDP
- int與Integer的區別
- Mysql與mongodb的區別MySqlMongoDB
- kill與pkill的區別
- HTML與XHTML的區別HTML
- CentOS 與 Ubuntu 的區別CentOSUbuntu
- artice與section的區別
- chown與chmod的區別
- synchronized與ReentrantLock的區別synchronizedReentrantLock
- LESS與SASS的區別
- synchronized與Lock的區別synchronized
- typedef與define的區別
- const與static的區別
- HTTP 與 HTTPS 的區別HTTP
- getAttribute() 與 attr() 的區別