09.索引-过滤索引
Posted ywnwa417
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了09.索引-过滤索引相关的知识,希望对你有一定的参考价值。
USE IndexDB
GO
SELECT * INTO SalesOrderheader FROM AdventureWorks2008r2.Sales.SalesOrderheader
GO
--Unique Clustered index
CREATE UNIQUE CLUSTERED INDEX ix_SalesOrderheader ON SalesOrderheader(SalesOrderid)
GO
--Filtered Index
CREATE INDEX ix_filtered_index ON SalesOrderheader(orderdate) WHERE orderdate>‘2008-01-01‘
SELECT orderdate,SalesOrderid FROM SalesOrderheader WHERE
orderdate>‘2008-05-01‘
GO
SELECT orderdate,SalesOrderid FROM SalesOrderheader WHERE
orderdate=‘2008-03-01‘
GO
SELECT orderdate,SalesOrderid FROM SalesOrderheader WHERE
orderdate=‘2007-12-01‘
参数化查询 可能会导致过滤索引失效
以上是关于09.索引-过滤索引的主要内容,如果未能解决你的问题,请参考以下文章