Click here to Skip to main content
15,895,011 members
Home / Discussions / Database
   

Database

 
QuestionBroken replication Pin
thaarM24-Nov-08 18:46
thaarM24-Nov-08 18:46 
Questionthanks Pin
Abhilash124-Nov-08 17:54
Abhilash124-Nov-08 17:54 
Questionhow to import excel sheet data to postgresql database Pin
Ranjt kumar24-Nov-08 8:56
Ranjt kumar24-Nov-08 8:56 
AnswerCross-post Pin
Wendelius24-Nov-08 9:26
mentorWendelius24-Nov-08 9:26 
QuestionAutogenerated / Numeric Primary Key Pin
CH SRINIW8Z24-Nov-08 4:39
CH SRINIW8Z24-Nov-08 4:39 
AnswerRe: Autogenerated / Numeric Primary Key Pin
Wendelius24-Nov-08 5:17
mentorWendelius24-Nov-08 5:17 
AnswerRe: Autogenerated / Numeric Primary Key Pin
Ashfield24-Nov-08 5:18
Ashfield24-Nov-08 5:18 
GeneralRe: Autogenerated / Numeric Primary Key Pin
Ben Fair25-Nov-08 4:01
Ben Fair25-Nov-08 4:01 
Another reason is if your primary key is also a clustered index, which it is by default, the rows are physically ordered by the key. If you use a character data type you can cause the database engine to have a lot of disk IO to re-order the data on inserts. This may not be that noticeable for tables without many inserts or when they are small, but for high-activity tables, especially if they get large (millions of rows) you'd want to stay away from it. Say for example you primary key column is varchar(10) and you started with 'a' as the first item's key value and went up through 'zzzzzzzzzz'. If you insert 'a' and then inserted 'zzzzzzzzzz', they would be stored physically in that order. Anything you insert afterwards may cause the database to move the rows around on disk in order to put the primary key columns in order. I say "may" because it will depend on how full a page is whether the engine has to create a new page, move data from one page to another, etc.

I worked on a project where the primary key columns were char(32) (a GUID without the dashes) and this situation, with the clustered indexes, wreaked so much havoc on performance that on almost every frequently-used table the primary key column's index was changed from clustered to non-clustered. Of course, that design was in place before I looked at it and I would highly discourage anyone from doing that. Personally, I've never found a reason not to use either int or bigint set as identity 1, 1 for the primary key.

Keep It Simple Stupid! (KISS)

GeneralRe: Autogenerated / Numeric Primary Key Pin
Ashfield25-Nov-08 9:21
Ashfield25-Nov-08 9:21 
QuestionHow to Solve Dead Lock problem in Sql Server 2005 Question Pin
pdnet24-Nov-08 1:37
pdnet24-Nov-08 1:37 
AnswerRe: How to Solve Dead Lock problem in Sql Server 2005 Question Pin
Wendelius24-Nov-08 2:01
mentorWendelius24-Nov-08 2:01 
GeneralRe: How to Solve Dead Lock problem in Sql Server 2005 Question Pin
CH SRINIW8Z24-Nov-08 4:48
CH SRINIW8Z24-Nov-08 4:48 
GeneralRe: How to Solve Dead Lock problem in Sql Server 2005 Question Pin
Wendelius24-Nov-08 5:28
mentorWendelius24-Nov-08 5:28 
GeneralRe: How to Solve Dead Lock problem in Sql Server 2005 Question Pin
Jon_Boy24-Nov-08 8:44
Jon_Boy24-Nov-08 8:44 
GeneralRe: How to Solve Dead Lock problem in Sql Server 2005 Question Pin
Wendelius24-Nov-08 9:36
mentorWendelius24-Nov-08 9:36 
QuestionNew Values in database Pin
Syed Shahid Hussain24-Nov-08 1:28
Syed Shahid Hussain24-Nov-08 1:28 
AnswerRe: New Values in database Pin
Paddy Boyd24-Nov-08 1:55
Paddy Boyd24-Nov-08 1:55 
AnswerRe: New Values in database Pin
Ben Fair24-Nov-08 3:43
Ben Fair24-Nov-08 3:43 
QuestionSql database from local system to Web hosting server Pin
pavanip23-Nov-08 20:10
pavanip23-Nov-08 20:10 
AnswerRe: Sql database from local system to Web hosting server Pin
Wendelius24-Nov-08 2:11
mentorWendelius24-Nov-08 2:11 
GeneralSql database from local system to Web hosting server Pin
pavanip24-Nov-08 2:22
pavanip24-Nov-08 2:22 
GeneralRe: Sql database from local system to Web hosting server Pin
Wendelius24-Nov-08 2:28
mentorWendelius24-Nov-08 2:28 
GeneralRe: Sql database from local system to Web hosting server Pin
pavanip25-Nov-08 2:31
pavanip25-Nov-08 2:31 
GeneralRe: Sql database from local system to Web hosting server Pin
Wendelius27-Nov-08 3:45
mentorWendelius27-Nov-08 3:45 
QuestionPerformance Issue with SQL server Pin
r aa j23-Nov-08 18:42
r aa j23-Nov-08 18:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.