Is this good practice? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Is this good practice?

Hi, I’m developing a db in SQL 2005. Is it good practice to give every primary key a clustered index? i don’t want to create a bad habit by just adding a clustered index in every prim. key if that isn’t good. Furthermore I’m having difficulty deciding when to use Nchar and VarChar. Example for a telephonenumber i’m using nchar and for an address i’m using VarChar which should I use?
Maurice
Primary key is the best candidate for clustered index becuase of high seletivity… http://www.sql-server-performance.com/clustered_indexes.asp
http://msdn2.microsoft.com/en-us/library/aa933131(SQL.80).aspx For Phone use use char if it is fixed lenght other wise use varchar… Nchar/nvarchar stores the data as Unicode. This would be
a good choice for an application required to work or potentially used in a
non-western or non-english language.
MohammedU.
Microsoft SQL Server MVP
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

Have you collected any stats using PERFMON and PROFILER for slow runnign queries, using DTA in SQL 2005 will give more information on what index you need to choose. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
@http://www.askasqlguru.com/ This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
Thanks for the info. I didn’t have any data yet Satya I was just wondering what the best way for setting up my tables was. Maurice
If you have completed the logical design then you could go and test with such stress testing tools to get more informatin. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
@http://www.askasqlguru.com/ This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
]]>