其他分享
首页 > 其他分享> > 创建索引

创建索引

作者:互联网

查看执行计划前

SET STATISTICS TIME ON;
GO
SET STATISTICS IO ON;
GO

创建更新索引

	USE XXX;
	GO
	-- create\update index 1: [IX_FileItem_XLIFFFileGuid_State]
	if exists(select * from sysindexes where name='IX_FileItem_XLIFFFileGuid_State')
	DROP  index [IX_FileItem_XLIFFFileGuid_State] ON FileItem;
	GO
	CREATE NONCLUSTERED INDEX [IX_FileItem_XLIFFFileGuid_State]
	ON [dbo].[FileItem] ([XLIFFFileGuid],[State])
	INCLUDE ([UpdatedAt],[FileGuid])
	GO


	-- create\update index 2: [IX_File_TargetType]
	if exists(select * from sysindexes where name='IX_File_TargetType')
	DROP  index [IX_File_TargetType] ON [File];
	GO
	CREATE NONCLUSTERED INDEX [IX_File_TargetType]
	ON [dbo].[File] ([TargetType])
	INCLUDE ([Guid],[TargetGuid],[SourceLanguage],[TargetLanguages])
	GO

        --查看所有索引
	--select * from sysindexes where name LIKE '%IX%'

标签:IX,TargetType,创建,索引,State,File,GO,FileItem
来源: https://www.cnblogs.com/tangge/p/12674995.html