查看执行计划前
--清空缓存数据
dbcc dropcleanbuffers
go
--清空缓存计划
dbcc freeproccache
go
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%'