SQL Server 2005索引过滤功能

发布于 2024-08-07 19:36:37 字数 132 浏览 4 评论 0原文

有人告诉我 SQL Server 2005 中有一个新功能,称为索引过滤器。

我想要做的是将索引添加到列并让索引忽略空值。

我找不到有关此功能的详细信息(也许我的来源是错误的)。任何人都可以提供有关此功能的更多信息吗?

I was told that there is new a feature in SQL Server 2005 called index filters.

What I want to do is add an Index to a column and have the index ignore null values.

I can't find good information on this feature (maybe my source is wrong). Can anyone provide additional information on this feature?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

⒈起吃苦の倖褔 2024-08-14 19:36:37
CREATE INDEX ix_mytable_mycolumn ON mytable(mycolumn) WHERE mycolumn IS NOT NULL

不过,这仅适用于SQL Server 2008

来自文档

WHERE ;

<块引用>

通过指定要包含在索引中的行来创建筛选索引。筛选索引必须是表上的非聚集索引。为筛选索引中的数据行创建筛选统计信息。

CREATE INDEX ix_mytable_mycolumn ON mytable(mycolumn) WHERE mycolumn IS NOT NULL

This will work only in SQL Server 2008, though.

From the docs:

WHERE <filter_predicate>

Creates a filtered index by specifying which rows to include in the index. The filtered index must be a nonclustered index on a table. Creates filtered statistics for the data rows in the filtered index.

北座城市 2024-08-14 19:36:37

我认为您正在谈论过滤索引,它是在 SQL Server 2008 中引入的,而不是 2005 中。

有关信息,请查看这篇文章:http://www.sql-server-performance.com/articles/dba/Filtered_Indexes_in_SQL_Server_2008_p1.aspx

或者只是在 google 上搜索“sql server 过滤索引” ”。

I think you are speaking about filtered indexes, which were introduced in SQL Server 2008, not 2005.

For information, have a look at this article: http://www.sql-server-performance.com/articles/dba/Filtered_Indexes_in_SQL_Server_2008_p1.aspx

Or just do a google search for "sql server filtered indexes".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文