Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Index - NVARCHAR(15)

Author  Topic 

gpayne
Starting Member

2 Posts

Posted - 2011-08-03 : 16:20:07
Hi all.

I am still learning some tricks of the trade with MS SQL and databases in general. However, I have a question.

I have recently added a column of type NVARCHAR(15) to an existing table of mine. I was wondering if there would be any impact as to whether or not if I should place an index on this column as I will be doing searches against this new column. The column WILL NOT have unique values per record. Will this have a certain impact on the database? Will this speed up my search times?

Any feedback would be greatly appreciated! Many thanks!!!

Greggory

GPayne
http://www.greggorypayne.com

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-03 : 16:22:07
Just add the index, no worries there. Yes it'll speed up your searches, assuming an index can be used for them.

SQL Server uniquifies indexes if they aren't already unique.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

gpayne
Starting Member

2 Posts

Posted - 2011-08-04 : 08:24:11
Thanks for the reply Tara. However, I would like to know, when would an index like this affect a query causing it to not be faster?

GPayne
http://www.greggorypayne.com
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-04 : 12:44:16
Creating indexes slow down your writes, however it should be a very tiny amount, assuming your hardware is good enough.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-08-04 : 13:03:41
quote:
Originally posted by gpayne

Thanks for the reply Tara. However, I would like to know, when would an index like this affect a query causing it to not be faster?



When the query can't use the index, due to non-SARGable predicates or incorrect index column order.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -