Oracle 9i & 10g編程藝術-深入資料庫體繫結構-學習筆記(持續更新中)

來源:互聯網
上載者:User

標籤:ble   學習   條目   好的   type   編程   amp   資料   arc   

 

 

--20170322

--1.0

--更新表的統計資訊
begin
dbms_stats.set_table_stats(user,‘EMP‘,numrows => 10000);
end;

begin
dbms_stats.set_table_stats(user,‘DEPT‘,numrows => 10000);
end;

--重新查看錶的統計資訊
select t.table_name,t.num_rows,t.blocks from user_tables t where t.table_name in (‘EMP‘,‘DEPT‘);
/*
DEPT    10000    100
EMP    10000    100
*/

--2.0

--查看索引佔用的資料區塊數、聚簇因子
select t1.index_name,t2.num_rows,t2.blocks ,t1.clustering_factor  from user_indexes  t1  inner  join user_tables t2  on t1.table_name=t2.table_name

/*
PK_YW_ZJFPJL    97    35    85
PK_YW_ZJFPDQ    3    5    1
PK_YW_YJFPLS_9    57    5    11
PK_YW_YJFPLS_8    35    5    1
PK_YW_YJFPLS_7    15    5    1
PK_YW_YJFPLS_6    19    5    1
*/

如果聚簇因子與塊數接近,則說明表相當有序,得到了很好的組織。即 一個葉子塊中的索引條目指向了同一個資料區塊中的行;

如果聚簇因子與行數接近,表的次序可能就是非常隨機的。即 同一個葉子塊上的索引條目不太可能指向同一個資料區塊中的行
--3.0

--type 使用細則,注意標紅地方哦
create or replace type emp_type
as object(
  EMPNO    NUMBER(4),
  ENAME    VARCHAR2(10),
  JOB      VARCHAR2(9),
  MGR      NUMBER(4),
  HIREDATE DATE,
  SAL      NUMBER(7,2),
  COMM     NUMBER(7,2)
);

create or replace type emp_tab_type as table of emp_type;

Oracle 9i & 10g編程藝術-深入資料庫體繫結構-學習筆記(持續更新中)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.