use TestDB create table tset3( tid int, tname varchar(10), pwd varchar(20) ) --默认是非聚集索引 create index FK_tset3_name on tset3(tname) with( drop_existing=off--on(原来无这个索引,则会提示找不到这个索引)删除原来的索引,create一个新的,off则如果里面有一个则提示错误,(按索引名来查找) ) create clustered index PK_tset_id on tset3(tid) with( drop_existing=off ) create unique nonclustered index UP_tset3_pwd on tset3(pwd) with( pad_index=on,--pad_index要有fillfactor才有用 fillfactor=50) --fillfactor=50创建索引时,每个索引页的数据占索引页大小的百分比 --一般看读写比。 --读写比:1:100=100 --读小于写:50-70 --读写各一半:80-90 --复合索引 create index FK_tset3_name_id on tset3(tname,tid) with( drop_existing=off--on(原来无这个索引,则会提示找不到这个索引)删除原来的索引,create一个新的,off则如果里面有一个则提示错误,(按索引名来查找) )
本文来自博客园,作者:阿霖找BUG,转载请注明原文链接:https://www.cnblogs.com/lin-07/articles/17333020.html