大话程序猿眼中的聚集索引和非聚集索引
2018-06-18 02:51:37来源:未知 阅读 ()
博客园将不进行维护,转站到我的个人博文:地址
从技术的角度来说,我他么这么流弊,怎么可以让查询这么卡。
CREATE TABLE [dbo].[Student]([ID] [INT] IDENTITY(1,1) NOT NULL,[Name] [NVARCHAR](50) NOT NULL,[Age] [INT] NOT NULL,[Height] [INT] NOT NULL,[Address] [NVARCHAR](100) NULL,[Class] [NVARCHAR](50) NOT NULL,[EntranceDateTime] [DATETIME] NOT NULL,CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED([ID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO
ALTER TABLE [dbo].[Student] ADD CONSTRAINT [DF_Student_EntranceDateTime] DEFAULT (GETDATE()) FOR [EntranceDateTime]GO
往表里插入 500万数据:
DECLARE @i INT;SET @i=1;WHILE(@i<5000001)BEGININSERT INTO dbo.Student(Name,Age,Height,[Address],Class,EntranceDateTime)VALUES('yang_'+CONVERT(NVARCHAR(10),@i),RAND()*10+7,RAND()*100+50,'厦门土豪小区1座'+CONVERT(NVARCHAR(10),CONVERT(INT,RAND()*100+1))+'号',CONVERT(NVARCHAR(10),CONVERT(INT,RAND()*6+1))+'年级',GETDATE())SET @i=@i+1;END
CREATE NONCLUSTERED INDEX [IX_Student_Age_Name] ON [dbo].[Student]([Age] ASC)INCLUDE ( [Name]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]GO 、
Ø [Col1] = 3.14Ø [Col1] > 100Ø [Col1] BETWEEN 0 AND 99Ø [Col1] LIKE 'abc%'Ø [Col1] IN (2, 3, 5, 7)
Ø ABS([Col1]) = 1Ø [Col1] + 1 = 9Ø [Col1] LIKE '%abc'
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- C语言程序结构 2020-05-31
- ftp客户端封装 2020-05-10
- C代做 C++代做 C++编程代做 C++程序代做 2020-04-29
- 测量C++程序运行时间 2020-04-17
- vscode C++ 程序 windows 2020-03-17
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash