记一次SqlServer大表查询语句优化和执行计划分析

数据库: sqlserver2008r2 

表: device_data

数据量:2000w行左右

表结构

CREATE TABLE [dbo].[device_data]( [Id] [int] IDENTITY(1,1) NOT NULL, [DeviceId] [nvarchar](30) NOT NULL, [CollectCycle] [int] NOT NULL, [BroadcastCycle] [int] NOT NULL, [Behavior] [tinyint] NOT NULL, [SystemTick] [int] NOT NULL, [Sport] [int] NOT NULL, [SportTime] [int] NOT NULL, [SleepTime] [int] NOT NULL, [Temperature] [int] NOT NULL, [Voltage] [int] NOT NULL, [DeviceSatatus] [int] NOT NULL, [DeviceType] [int] NOT NULL, [FireVersion] [int] NOT NULL, [SportRange] [int] NOT NULL, [UploadTime] [datetime] NOT NULL, [DataFlag] [tinyint] NOT NULL, [TagType] [tinyint] NOT NULL, [RSSI] [tinyint] NOT NULL, [CollectorMac] [nvarchar](20) NOT NULL, CONSTRAINT [PK__device_d__3214EC0770FDBF69] 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]

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpypyy.html