Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
BRH 6
Index 6
Non-Clustered Index 5
Performance 4
#SQLServer 3
#TSQL 2
SQLServer 2
Clustered Index 2
Filtered Index 2
SSMS 2

Archive · View All
April 2010 7
March 2010 4
August 2010 2
May 2010 2
October 2011 1
September 2010 1

Filtered Index

Apr 6 2010 6:01AM by Dinesh Asanka   

Having discussed about indexes into some level, now it is time to discuss new index type which came along with SQL Server 2008, filtered index.

In filtered index, you can define index to the filter portion of your data. For example, you can create a non-clustered as following.

CREATE NONCLUSTERED INDEX NCI_Employee

ON HumanResources.Employee(EmployeeID)

WHERE Title= 'Marketing Manager'

NCI_Employee index will create index on EmployeeID where Title equal to Marketing Manager.

Let us analyze this using Execution plans as we did before.

SELECT he.EmployeeID,he.LoginID,he.Title

FROM HumanResources.Employee he

WHERE he.Title = 'Marketing Manager'

CREATE NONCLUSTERED INDEX NCI_Employee

ON HumanResources.Employee(EmployeeID)

WHERE Title= 'Marketing Manager'

SELECT he.EmployeeID,he.LoginID,he.Title

FROM HumanResources.Employee he

WHERE he.Title = 'Marketing Manager'

First query will run without a filtered index, while second query will have the filtered index.

clip_image002

So you can see the difference where first query has 24 % query cost and with the filtered index , query cost has gone down to 20%.

Now let us analyze this with another scenario as showed below.

SELECT he.EmployeeID,he.LoginID,he.Title

FROM HumanResources.Employee he

WHERE he.Title = 'Marketing Manager'

SELECT he.EmployeeID,he.LoginID,he.Title

FROM HumanResources.Employee he

WHERE he.Title = 'Quality Assurance Supervisor'

clip_image004

Again you can see first query will use the non-clustered filtered index key, while second query does not have an index to use. Hence it will use clustered index key.

Limitations.

1. Filtered index can be created only on non-clustered indexes.

2. Index has to be simple query. You cannot use something like this.

CREATE NONCLUSTERED INDEX NCI_Employee2

ON HumanResources.Employee(EmployeeID)

WHERE ContactID IN (SELECT ContactID FROM Person.Contact WHERE EmailPromotion =2 )

3. Index where clause cannot have LIKE clause.

4. Index cannot be created on Text,ntext,varcahr(max),nvarchar(max), spatial data type columns.

Tags: Index, Filtered Index, Non-Clustered Index,


Dinesh Asanka
116 · 1% · 444
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Filtered Index" rated 5 out of 5 by 1 readers
Filtered Index , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]