Oracle表分類:普通堆表,索引組織表,簇表,全局臨時表,外部表,分區表。
普通堆表的不足之處:
1.表更新日誌開銷(能夠在適當的場合選擇全局臨時表)
2.表的delete操做有瑕疵(可在適當場合考慮全局臨時表和分區表)
3.表的數據太大檢索慢(可在適當場合選擇分區表)
4.索引回表讀開銷大(可在適當的場合選擇索引組織表)
5.有序插入難有序讀出,(後插入的記錄首先尋找並填充 delete 操做後的 "空塊") (可在適當的場合選擇簇表)
回表:在數據中,當查詢數據的時候,在索引中查找索引後,得到該行的rowid,根據rowid再查詢表中數據,就是回表。
create table s1 as select * from dba_objects where rownum<=200;
create index index_obj on s1(object_id);
set autotrace traceonly;
LISN@orcl>select * from s1 where object_id < 10;
select * from s1 where object_id < 10;
8 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 3647141056
-----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 8 | 1656 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| S1 | 8 | 1656 | 2 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | INDEX_OBJ | 8 | | 1 (0)| 00:00:01 |
-----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OBJECT_ID"<10)
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
2235 bytes sent via SQL*Net to client
523 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
8 rows processed
-- INDEX RANGE SCAN| INDEX_OBJ 不須要回表
#####################
ide