Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql Server Performance And Order Of Fields

does the order of fields creation in a table effect on the performance of commands on the table? If the answer is yes, can anyone discuss it?

For example i have create a table like this

create table Software(int id,alpha datetime,beta datetime,title nvarchar(100),stable datetime,description nvarchar(200) )

if i change it to

create table Software(int id,alpha datetime,beta datetime,stable datetime,description nvarchar(200),title nvarchar(100) )

Is there any performance effect ?

Is it clear?

like image 779
Saleh Avatar asked Apr 30 '11 04:04

Saleh


2 Answers

The field order makes no difference whatsoever (if the fields are always the same of course)

The on-disk structure will remain the same pretty much regardless. Simply:

  • header
  • fixed length columns
  • null bitmap
  • variable length columns

All you're doing above is rearranging some columns inside the "fixed length" and "variable length" sections. However, the same processing is required to retrieve them no matter which order they are in.

See Paul Randal's article

like image 148
gbn Avatar answered Nov 09 '22 12:11

gbn


No. This will not affect performance.

like image 36
Henry Avatar answered Nov 09 '22 13:11

Henry