November 19, 2008 at 10:16 am
I use nvarchar field to identify records in a database table due to an Identity Field is used as Primary Key.
My partner considers we must change our model to use the primary key as the way to identify my records but this is not a constant value. He told me this model has lot performance problems.
I don’t think so, because this table doesn’t grow, it just has at most 100 rows.
I want to know if with this model I could have significant performance problems.
The problem is if I must change this model I need to change a lot code to fix this issue. I need a good reason to continue with my model because we are in the project timeline
Thanks a lot [Smile]
November 19, 2008 at 10:27 am
are you saying that the primary key on your table is a nvarchar?
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
November 19, 2008 at 10:44 am
How about showing us what your are talking about? Could you post the DDL for the table and some sample data?
November 19, 2008 at 12:52 pm
My table primary key is an int and it is a identity field, for this reason I using another column to identify the rows.
Some thing like this:
Table: Language
Columns:
LanguageId (int, pk)
Code (nvarchar(30)) --> I am using this column
My current database has 654 tables and i just need to manage one table in this way. 🙁
November 19, 2008 at 12:56 pm
I want to know if I use this nvarchar column in sql queries, to identify the rows, has performance problems
Thanks!
November 19, 2008 at 1:00 pm
Sorry , I forgot the example
LanguageId CodeDescriptionFrDescriptionEn
195 de NULL German
196 el NULL Greek
197 en NULL English
November 19, 2008 at 1:38 pm
Is the code column defined as nvarchar(2) or something else? If all your codes are 2 characters you should use nchar(2).
Do you mean you are using the code column to define foreign key relationships to this table? Or, are you using it in WHERE clauses?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 19, 2008 at 1:42 pm
arluna (11/19/2008)
I want to know if I use this nvarchar column in sql queries, to identify the rows, has performance problems
Shouldn't, as long as it's indexed
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 19, 2008 at 1:49 pm
Yes, but I have a restriction about this; I just can manage 5 nvarchar sizes for the current project:
S: 30, M:50, L:100,XL:250,XXL:2000, it’s a standard.
This column is not a FK, I am using this column to identify rows in where clauses. I think it does not have a performance problem but I need a second opinion to defend my point of view
Thank you!
November 19, 2008 at 1:52 pm
Like Gail said, if you have it indexed properly there is no reason not to use it in a where clause.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 19, 2008 at 1:55 pm
Thanks a lot!
Viewing 11 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply