SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Index
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

suriyarupa
Starting Member

19 Posts

Posted - 05/06/2013 :  02:43:55  Show Profile  Reply with Quote
Creating index with varchar datatype is better? or with nvarchar is better? I know with integers it will give good performance. But i want to create index with string columns.

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 05/06/2013 :  02:59:37  Show Profile  Reply with Quote
nvarchar will assume more space for storage and index table will also increase (assuming non clustered). But if there's a compelling reason for field to be nvarchar then keep it as is (just like storing different language characters etc)
Choice of column(s) for index will also depend on lot of other factors like selectivity of data, usage in queries tec

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

suriyarupa
Starting Member

19 Posts

Posted - 05/06/2013 :  03:16:42  Show Profile  Reply with Quote
Thanks visakh.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 05/06/2013 :  04:31:36  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

suriyarupa
Starting Member

19 Posts

Posted - 05/06/2013 :  07:35:44  Show Profile  Reply with Quote
Hi vishak,

I want to create index with 6 columns, all are having nvarchar(50) datatype. Can I create? It will reduce execution time?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 05/06/2013 :  07:41:44  Show Profile  Reply with Quote
quote:
Originally posted by suriyarupa

Hi vishak,

I want to create index with 6 columns, all are having nvarchar(50) datatype. Can I create? It will reduce execution time?



Not something anybody can easily advise you on without knowing your table size, columns involved, their usage in queries, data selectivity, uniqueness etc in each of those columns


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000