Author |
Topic |
shubhada
Posting Yak Master
117 Posts |
Posted - 2008-04-18 : 08:45:31
|
Hi, In interview i have asked follwoing question 1. U have one query ,how u will optiminze the query for bette performance.2. Use of update statics3. consider on one column we definde a constaint unique key and not null. so is it possible to create a primary key on the same column?Please provide me answer for all above questionsRegards,SHubhada.SQLTeam |
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2008-04-18 : 11:55:32
|
1. create an index for every column in the table.2. use to determine when backups are needed3. If it's a numeric type, yes. Otherwise no.;) |
 |
|
Van
Constraint Violating Yak Guru
462 Posts |
Posted - 2008-04-18 : 12:23:20
|
Actually for number 3 you can if it's "int" or "bigint" as well... |
 |
|
tosscrosby
Aged Yak Warrior
676 Posts |
Posted - 2008-04-18 : 14:35:40
|
Actually Cat, for number 1, would that be one index for each column and then one across all columns?? Never seem to get that one right!Terry |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-04-18 : 16:36:56
|
"1. create an index for every column in the table.2. use to determine when backups are needed3. If it's a numeric type, yes. Otherwise no."Not really,This is not true.1)Depends on the query. Database tuning advisor,execution plan will better guide you about index for better performance. Too many indexes affects performance2)Increase the performance of the query.3)Yes as long as there is no clustered index defined |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-04-18 : 16:55:45
|
sodeep, your sarcasm detector must not be working.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-18 : 17:09:24
|
Maybe because he is using TINYBIT datatype? E 12°55'05.25"N 56°04'39.16" |
 |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2008-04-19 : 00:27:59
|
quote: Originally posted by shubhadaIn interview i have asked follwoing question 1. U have one query ,how u will optiminze the query for bette performance.2. Use of update statics3. consider on one column we definde a constaint unique key and not null. so is it possible to create a primary key on the same column?
Dude! Forget about optimizing! You're never going to get past the syntax errors!e4 d5 xd5 Nf6 |
 |
|
tosscrosby
Aged Yak Warrior
676 Posts |
Posted - 2008-04-21 : 15:51:12
|
Sarcasm? Who, me? I ask a legitimate question and now I'm accused of sarcasm? I'm just trying to figure out this here SQL, ya' know, for bette preformance and stuff!!! Backups, what's that??? Statics, that's for wimps. And, I don't even want to definde a constraint...sounds too painful.....Terry |
 |
|
|