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
 General SQL Server Forums
 New to SQL Server Programming
 Index

Author  Topic 

suriyarupa
Starting Member

19 Posts

Posted - 2013-05-06 : 02:43:55
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

52326 Posts

Posted - 2013-05-06 : 02:59:37
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 - 2013-05-06 : 03:16:42
Thanks visakh.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-06 : 04:31:36
welcome

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

suriyarupa
Starting Member

19 Posts

Posted - 2013-05-06 : 07:35:44
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

52326 Posts

Posted - 2013-05-06 : 07:41:44
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
   

- Advertisement -