Sunday, February 12, 2012

clustered index on nvarchar column or int...

Users can approach their userprofile on my site using:www.mysite.com/name=peter
Name is a unique value within my database (db type: nvarchar(50))

Now, I have created a clustered index on the username column.
However, IMHO its faster to create a clustered index on the (also unique) usercode column since that is of type int.

BUT since a user can approach my site based on username I feel that I HAVE to live with this setback in performance...

Is that true or is there a better way to solve this issue?Your clustered index does not have to include the primary key column. Check out this page fortips on performance tuning clustered indexes.

No comments:

Post a Comment