我有一个观点让我非常疯狂..
表AlarmMsg
如下所示:
[TypeID] [smallint] NULL,
[SEFNum] [int] NULL,
[ServerName] [nvarchar](20) NOT NULL,
[DBName] [varchar](20) NOT NULL,
[PointName] [varchar](50) NOT NULL,
[AppName] [varchar](50) NOT NULL,
[Description] [varchar](100) NOT NULL,
[Priority] [tinyint] NOT NULL,
[Value] [float] NOT NULL,
[Limit] [float] NOT NULL,
[Msg] [nvarchar](255) NULL,
[DateStamp] [datetime2](7) NULL,
[UID] [uniqueidentifier] NOT NULL
在该AlarmMsg
表的顶部是一个应用的视图,如下所示:
CREATE VIEW AlarmMsgView
AS
SELECT TOP (2000) WITH TIES
SEFNum, ServerName, DBName,
PointName, AppName, Description,
Priority, Value, Limit, Msg,
DateStamp, UID
FROM dbo.AlarmMsg WITH (NOLOCK)
ORDER BY DateStamp DESC
此查询直接针对表返回预期的十 (10) 行:
SELECT TOP(10) [SEFNum]
FROM [RTIME_Logs].[dbo].[AlarmMsg]
where [Priority] = 1
对视图的相同查询返回......没有(!):
SELECT TOP(10) [SEFNum]
FROM [RTIME_Logs].[dbo].[AlarmMsgView]
where [Priority] = 1
该表AlarmMsg
包含大约 11M+ 行,并在 column 上声明了一个 FT 索引Msg
。
有人可以告诉我这里发生了什么,我想我正在失去理智。