_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › SparseColumnsAndColumnSets
|
|
[edit]
1 Sparse Columns #ろ 伎 Null螳 豕 レ螳 朱 伎 襷. 蟠レ 豕 20% ~ 40% 螻糾 暑 蟆曙一 . 磯 碁煙れ 螳 . Geography, geometry, image, ntext, text, timestamp, user-defined data types 一危 sparse襦 讌 . れ 襷 伎企.
螻蠍語企一危壱
豌 襴酔 譬 蠍語 一危
一危 譬 蠍語 一危
[edit]
2 Example #--drop table sparse_table create table sparse_table ( sparse_col nchar(4) sparse null ); --drop table non_sparse_table create table non_sparse_table ( non_sparse_col nchar(4) null ); with temp(num) as ( select 1 num union all select num + 1 from temp where num + 1 <= 10 ) insert sparse_table(sparse_col) select N'覘°蟾?' -- 100000蟇 from temp a, temp b, temp c, temp d, temp e union all select NULL -- 100000蟇 from temp a, temp b, temp c, temp d, temp e; with temp(num) as ( select 1 num union all select num + 1 from temp where num + 1 <= 10 ) insert non_sparse_table(non_sparse_col) select N'覘°蟾?' -- 100000蟇 from temp a, temp b, temp c, temp d, temp e union all select NULL -- 100000蟇 from temp a, temp b, temp c, temp d, temp e; exec sp_spaceused 'sparse_table' exec sp_spaceused 'non_sparse_table' /* name rows reserved data index_size unused ------------ ------ -------- ------- ---------- ------ sparse_table 200000 3720 KB 3664 KB 8 KB 48KB name rows reserved data index_size unused ------------ ------ -------- ------- ---------- ------ sparse_table 200000 3400 KB 3368 KB 8 KB 48KB */ [edit]
4 Example #--drop table column_sets create table column_sets ( sparse1 int primary key , sparse2 int sparse null , sparse3 nvarchar(20) sparse null , cs xml column_set FOR ALL_SPARSE_COLUMNS ); insert column_sets(sparse1, sparse2, sparse3) values (1, 1, N'願唄覘?') , (2, null, N'覘螳襷?'); select * from column_sets; select sparse1, sparse2, sparse3, cs from column_sets CREATE TABLE t ( i int SPARSE , cs xml column_set FOR ALL_SPARSE_COLUMNS ); INSERT t(cs) VALUES ('<i/>'); SELECT i FROM t; SELECT * FROM t; [edit]
5 谿瑚襭 #
鏤
|
螳 れ 豺 糾豌 れ 企伎. |