问题标签 [filtered-index]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
95 浏览

sql-server - SQL Server 2012 临时过滤索引?

我有一个复杂的存储过程,它填充了一个大约 400,000 行的#temp 表。有一些 row_number() 热度标识的重复项。稍后在行号大于 1 的存储过程中删除重复项。

最慢的部分是删除,添加索引会有所帮助。但是,当在生产环境中运行许多连接执行相同操作时,在临时表上创建同名索引时会发生冲突。

在临时表上创建名称安全临时索引的正确方法是什么?我在想,在 row_number 列和 ID 的组合上创建主键可能会起作用,但这可能会改变更多的 sproc 代码。

所有想法都表示赞赏。

谢谢。

0 投票
3 回答
387 浏览

sql-server - 是否可以在列值不是“X”的情况下编写过滤索引?

我正在尝试优化表查找,因为执行计划显示了相当大量的并行表扫描。该表被调用Opportunity,我正在过滤的列是Name. 具体来说,我希望所有没有“补充”的行作为Name

我一直在寻找一种优化它的方法,并遇到了我需要的过滤索引,但他们似乎不喜欢这个LIKE关键字。有没有另一种方法来创建这样的过滤索引?

该表有大约 53k 行,直接查询服务器时需要 4 秒才能获取数据,但是当我将其作为链接服务器(这是我需要的)查询时需要 2 分钟。为了改善这个时间,我将查询从与链接服务器对话的脚本中移出,并在远程服务器上创建了一个视图。仍然需要永远。

到目前为止,这是我尝试过的,但 SSMS 说它无效:

在此先感谢您的任何建议!

0 投票
1 回答
642 浏览

sql-server - filtered index or indexed view for Soft-delete with deleteAt dateTime column?

We use a deleteAt column to specify whether something is active or (soft) deleted. Which technique is best going forward for querying active contents?

Would a filtered index on the actual table better, or an indexed view with deleteAt is NULL?

Is this a good use case for indexed view?

Or should we go for regular view with filtered index?

0 投票
0 回答
79 浏览

sql-server - sql server 过滤索引 <> 0 的执行方式是否与 > 0 不同?

我有一个带有 Id 列的表。

此列始终保持值 >= 0(没有约束来断言)。

我在此列上有一个索引,过滤为value > 0.

如果过滤器是value <> 0

也许一个是最佳实践,另一个是坏的......

编辑,我写了这个脚本:

我对结果有点困惑:

tst20150513_2_1、tst20150513_2_4 和 tst20150513_2_5 有 5006 次逻辑读取。这些表的共同点是它们的索引要么没有被过滤,要么与“关联”CHECK子句完美地“结合”。

我不明白为什么它们比其他两个带有索引过滤器但没有CHECK子句的表具有更多的逻辑读取。

0 投票
2 回答
3603 浏览

sql - TSQL 多列唯一约束,也允许多个空值

我目前正在从 MS Access 迁移到 SQL Server。Access 允许在唯一索引中使用多个 Null,而 SQL Server 不允许...我一直在通过删除 SQL Server 中的索引并添加过滤索引来处理迁移:

我遇到的问题是我不确定如何实现复合或多列“过滤”索引......或者这是否真的可能,因为我在研究它时没有找到任何例子。

我确实有一个想法通过创建过滤索引来实现它,如下所示:

然后添加第二个过滤索引:

但我不确定这是否会奏效,更不用说是最好的方法了。非常感谢您提供正确方向的指导。

0 投票
1 回答
500 浏览

sql-server - SQL Server 筛选索引 WHERE 列 = 列

我希望尝试在表中使用过滤索引SQL Server 2012来查看它是否会改善查询执行,尽管在尝试创建它时我收到以下错误:

消息 10735,级别 15,状态 1,行 3
表 'dbo.SRReferralIn' 上过滤索引 'IX_SRReferralIn_Filtered' 的 WHERE 子句不正确。

以下是我正在使用的声明。RowIdentifier并且IDOrganisationVisibleToCLUSTERED PRIMARY KEY

WHERE不支持子句中的表达式吗?

0 投票
0 回答
611 浏览

android - 过滤数组列表 based on based between two intervals android

In Arraylist, how can one filtered the arraylist to rows between 2 dates.

For example,

find all the students in arraylist from october to december 2015.

In Arraylist, how can one filtered the arraylist to rows between 2 dates.

For example,

find all the students in arraylist from october to december 2015.

Here is my working. if the date is between the start and ending date. It must display true else its false

The above method is used to filter my baseadapter.


A fact or fact table is the central table in a Star or Snowflake schema of a data warehouse. A fact table stores quantitative information for analysis and is often denormalized. It measures the business operations in the organization. It is included in every data warehouse or data mart.

Facts are the measurements that result from a business process event and are almost always numeric. A single fact table rows has a one-to-one relationship to a measurement event as described by the fact table's grain. Fact table corresponds to a physical observable event.

Within a fact table, only fact consistent with the decraled grain are allowed. The fact table work with dimension tables. The fact table holds the ways in which the fact table data can be analyzed. There are two type of columns in there - foreign key columns for join with the dimensions and the measures columns, containing the data analyzed.

Example

In retail sales transaction, the quantity of a product sold and its extended price are good facts. Store manager's salary is disallowed in the fact table.

Links

0 投票
1 回答
501 浏览

sql - 列出 SQL Server 中的所有索引列(包括过滤的列)

如何获取包括过滤列在内的所有索引列?

这个例子给出了两行而不是三行。

0 投票
1 回答
1418 浏览

excel-2013 - 编辑筛选列表时 Excel 崩溃

我有一个大型(5000 行 x 45 列)列表,我从另一个软件包作为 csv 导入。它包含的原因并不总是准确的,因此我按原因过滤并在另一列中查看评论以更正原因。很多时候,当我这样做时,Excel 会停止并完全崩溃或使用恢复的文件重新启动。我不能使用查找和替换,因为有时原因是正确的。这是 Excel 的正常行为吗?

0 投票
1 回答
5434 浏览

mongodb - 部分索引有什么限制?

最新版本的 MongoDB (v3.2) 增加了对部分(过滤)索引的支持。您在创建索引时提供了一个过滤器,该过滤器确定哪些文档将在索引中引用,哪些不会。

我可以使用任何过滤器表达式(只要它是有效的过滤器)?或者使用的过滤器有限制吗?如果是这样,这些限制是什么?