學習Oracle的索引、表的儲存

heming96發表於2008-07-20
每個索引鍵值 佔用1024 位元組 ,同樣表的每一行也佔用1024位元組, 如果超過1024位元組之後呢? 找時間試試[@more@]
create table t1(x char(1024));
create index ti on t1(x);
insert into t1 values(1);
commit;
begin
for i in 2..7 loop
insert into t1 values(i);
end loop;
end;
/
commit;
begin
for i in 2..7 loop
for j in 3..9 loop
insert into t1 values(i*10+j);
end loop;
end loop;
end;
/
commit;
for i in 2..7 loop
for j in 3..9 loop
insert into t1 values(i*100+j*10+1);
end loop;
end loop;
end;
/
commit;
begin
for i in 22..27 loop
insert into t1 values(i);
end loop;
end;
/
commit;
select file_id,extent_id,block_id,blocks from dba_extents where segment_name='TI';
ANALYZE INDEX TI VALIDATE STRUCTURE;
select btree_space,used_space,pct_used,blocks,lf_blks,br_blks from index_stats;

alter system dump datafile 11 block 858;
alter system dump datafile 11 block 877;
alter system dump datafile 11 block 878;
alter system dump datafile 11 block 88
alter system dump datafile 11 block 879;
每個索引鍵值 佔用1024 位元組 , row#0[1822] flag: -----, lock: 0 col 0; len 1024; (1024): 35 34 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
....
col 1; len 6; (6): 02 c0 03 5d 00 00
同樣表的每一行也佔用1024位元組,
tl: 1030 fb: --H-FL-- lb: 0x1 cc: 1
col 0: [1024]
35 34 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
如果超過1024位元組之後呢?
tl: 1585 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [1576]
31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31

參考文章:

http://www.itpub.net/viewthread.php?tid=237710&extra=&page=1

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9614263/viewspace-1007520/,如需轉載,請註明出處,否則將追究法律責任。

相關文章