delete 刪除資料 全表掃描還是掃描所有塊的測試
SQL> select count(distinct b) from
2 (select dbms_rowid.rowid_block_number(rowid) b from t);
COUNT(DISTINCTB)
----------------
80
SQL> select object_id,object_name from t where object_id=6318;
OBJECT_ID
----------
OBJECT_NAME
--------------------------------------------------------------------------------
6318
T2
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT ptimizer=CHOOSE (Cost=9 Card=1 Bytes=19)
1 0 TABLE ACCESS (FULL) OF 'T' (Cost=9 Card=1 Bytes=19)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
80 consistent gets
0 physical reads
0 redo size
443 bytes sent via SQL*Net to client
503 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> delete from t where rownum<3000; --刪除3000條記錄 總共6174條記錄
2999 rows deleted.
sql>commit
SQL> select object_id,object_name from t where object_id=6318;
OBJECT_ID
----------
OBJECT_NAME
--------------------------------------------------------------------------------
6318
T2
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT ptimizer=CHOOSE (Cost=9 Card=1 Bytes=19)
1 0 TABLE ACCESS (FULL) OF 'T' (Cost=9 Card=1 Bytes=19)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
80 consistent gets --刪除後全表掃描還是和原來一樣大
0 physical reads
0 redo size
443 bytes sent via SQL*Net to client
503 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> alter tablespace tools read write;
Tablespace altered.
SQL> alter table t move tablespace tools; 把表t移到另外個表空間tools 重新組織塊
Table altered.
SQL> select count(distinct b) from
2 (select dbms_rowid.rowid_block_number(rowid) b from t);
COUNT(DISTINCTB)
----------------
40
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT ptimizer=CHOOSE
1 0 SORT (GROUP BY)
2 1 TABLE ACCESS (FULL) OF 'T'
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
44 consistent gets --一致性讀降低
40 physical reads
60 redo size
387 bytes sent via SQL*Net to client
503 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
1 rows processed
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-243818/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- delete 與全表掃描delete
- (轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- 轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- oracle 全表掃描,索引範圍掃描與塊的理解Oracle索引
- Oracle中存取資料掃描Table及索引的方式(全表掃描,索引掃描等)Oracle索引
- MySQL中的全表掃描和索引樹掃描MySql索引
- 優化全表掃描優化
- oracle是如何進行全表掃描的Oracle
- 索引全掃描和索引快速全掃描的區別索引
- 使用索引快速全掃描(Index FFS)避免全表掃描的若干場景索引Index
- ORACLE全表掃描查詢Oracle
- 查詢全表掃描的sqlSQL
- 24_Oracle資料庫全表掃描詳解(四)_全表掃描生產最佳化案例三則Oracle資料庫
- 查詢全表掃描語句
- oracle優化:避免全表掃描Oracle優化
- 抓取全表掃描的表,篩選和分析
- 23_Oracle資料庫全表掃描詳解(三)Oracle資料庫
- 22_Oracle資料庫全表掃描詳解(二)Oracle資料庫
- 21_Oracle資料庫全表掃描詳解(一)Oracle資料庫
- 關係型資料庫全表掃描分片詳解資料庫
- 掃描技術和掃描工具
- 優化Oracle with全表掃描的問題優化Oracle
- oracle實驗記錄(分割槽全表掃描(全區掃描) FTS 時候的成本計算)Oracle
- 【MySQL】全索引掃描的bugMySql索引
- 掃描所有無線網路
- 一條全表掃描sql語句的分析SQL
- 優化Oracle with全表掃描的問題(二)優化Oracle
- Web應用掃描測試工具VegaWeb
- 全表掃描的cost 與 索引掃描Cost的比較 – 無直方圖(10.1.0.3以後)索引直方圖
- AWVS掃描器掃描web漏洞操作Web
- nmap掃描網段內的所有IP
- win10系統掃描器提示掃描不到掃描器如何解決Win10
- 累計的力量,delete全表掃描導致程式執行時間過長。delete
- 索引掃描可能不如全表掃描的場景的理解__純粹資料量而言,不涉及CLUSTERING_FACTOR索引
- 有索引卻走全表掃描的實驗分析索引
- noworkload下全表掃描cost的計算
- 隱形轉換導致全表掃描案例
- 掃描王 for Mac專業圖片掃描工具Mac