createtablex(iint,namevarchar(20));Tablecreated.SQL>selectcount(*)fromx;COUNT(*)----------0Statistics----------------------------------------------------------1recursivecalls0dbbloc" />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

oracle:block 的 water mark問題

系統 2292 0

? ? ?看了小布老師關于block里面數據存儲的high water mark的實驗,自己也做了一遍。

?

SQL> create table x(i int,name varchar(20));

Table created.

?

SQL> select count(*) from x;

COUNT(*)
----------
0

Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
514 bytes sent via SQL*Net to client
469 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

?

SQL> begin
2 for i in 1 ..100000
3 loop
4 insert into x values(i,'my');
5 end loop;
6 commit;
7 end;
8 /

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

?

SQL> select count(*) from x;

COUNT(*)
----------
100000

Statistics

----------------------------------------------------------
0 recursive calls
0 db block gets
186 consistent gets
0 physical reads
0 redo size
515 bytes sent via SQL*Net to client
469 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 x;

100000 rows deleted.

?

Statistics

----------------------------------------------------------
1062 recursive calls
104609 db block gets
790 consistent gets
5 physical reads
25386252 redo size
838 bytes sent via SQL*Net to client
709 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
100000 rows processed

SQL> commit;

Commit complete.

?

SQL> select count(*) from x;

COUNT(*)
----------
0

Statistics

----------------------------------------------------------
0 recursive calls
0 db block gets
186 consistent gets
0 physical reads
0 redo size
514 bytes sent via SQL*Net to client
469 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

?

?

SQL> truncate table x;

Table truncated.

?

SQL> select count(*) from x;

COUNT(*)
----------
0

Statistics

----------------------------------------------------------
1 recursive calls
1 db block gets
6 consistent gets
0 physical reads
96 redo size
514 bytes sent via SQL*Net to client
469 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

?

?

----------------

通過上面的實驗,我們可以看出water mark的作用。

如果delete 數據,oracle去查詢時,還是要從0開始查,直至water mark為止。

如果truncate數據,也就是說,oracle發現water mark=0,直接就返回了。其實truncate是把表的segment給清除了,自然不占用空間。

?

(有個疑問,小布老師實驗里面,physical reads是比較大的;我的實驗里面physical reads=0;

也就是說數據一直保存在內存里面,沒有保存到硬盤;我的環境是10.2.0.1,他是9i有關系?

還是10g有個系統表對數據自動統計,現在還沒統計的原因?)

?

?

oracle:block 的 water mark問題


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 天长市| 芦山县| 右玉县| 普洱| 屏南县| 东阿县| 犍为县| 秦安县| 庆阳市| 越西县| 常德市| 新安县| 五寨县| 青河县| 汉川市| 临海市| 喀喇| 竹溪县| 澜沧| 临汾市| 电白县| 贡嘎县| 新巴尔虎右旗| 桓仁| 明水县| 河池市| 上栗县| 浠水县| 潍坊市| 湖州市| 九江县| 辛集市| 海伦市| 曲周县| 攀枝花市| 汾阳市| 沛县| 饶河县| 左云县| 甘肃省| 邹平县|