August 2, 2010 at 12:41 pm
If I have to create a table with all sorts of data types and sizes, should there be an order?
Does it matter if the primarykey column is or is not the first column?
August 2, 2010 at 1:58 pm
The order columns are defined is irrelevant, it won't usually match the order they're stored in the page anyway. This was true on SQL 2000 as well, probably 7 too (since the engine didn't change radically between 7 and 2000). Can't say for 6.5 or earlier.
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
August 2, 2010 at 2:06 pm
I don't think it's ever mattered, but I second Gail's note. It doesn't matter.
August 2, 2010 at 2:46 pm
I doubt order is of any concern with the current versions (2005/2008).
You need to keep in mind the total length of fixed data types is still restricted to 8060 bytes.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
August 4, 2010 at 3:54 pm
From a standardizaton standpoint yes the Primary / Composite Key columns should be the first column(s). Don't underestimate the benefits of designing legibility into your solutions.
From a performance angle yes order most certainly matters in your supporting indexes. But don't order by data type, order the columns in your indexes by usage patterns.
Dan
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply