Unix Technical Forum

sequence of columns and preformance

This is a discussion on sequence of columns and preformance within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello, I am learning SQL Server and I would like to ask you a question. Could you tell me ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 07:50 PM
R.A.M.
 
Posts: n/a
Default sequence of columns and preformance

Hello,
I am learning SQL Server and I would like to ask you a question. Could
you tell me please if sequence of columns in a table has influence on
performance?
Thank you very much
/RAM/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 07:50 PM
Greg D. Moore \(Strider\)
 
Posts: n/a
Default Re: sequence of columns and preformance


"R.A.M." <r_ahimsa_m@poczta.onet.pl> wrote in message
news:rcbpa2d4st31kod14pvig3dihkiockuv6r@4ax.com...
> Hello,
> I am learning SQL Server and I would like to ask you a question. Could
> you tell me please if sequence of columns in a table has influence on
> performance?


Not sure what you mean?

But I'm sorta guessing you're making an assumption which is wrong.

A table itself has no inherent order.

So if you insert 5 rows, there's no guarantee a select statement will return
them in the same order you inserted them.

If you want an order, you must have an order by clause in your statement.

If you want to increase performance of queries, you will want to use
indexes. This keeps track of the "order" of the columns in question. But
doesn't really provide a "sequence."


> Thank you very much
> /RAM/



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 07:51 PM
Erland Sommarskog
 
Posts: n/a
Default Re: sequence of columns and preformance

R.A.M. (r_ahimsa_m@poczta.onet.pl) writes:
> I am learning SQL Server and I would like to ask you a question. Could
> you tell me please if sequence of columns in a table has influence on
> performance?


If you mean whether it matters whether you say

CREATE TABLE tbl (a int NOT NULL,
b int NOT NULL,
c int NOT NULL)

or

CREATE TABLE tbl (cint NOT NULL,
b int NOT NULL,
a int NOT NULL)

the answer is: No.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 07:51 PM
--CELKO--
 
Posts: n/a
Default Re: sequence of columns and preformance

>> Could you tell me please if sequence of columns in a table has influence on performance? <<

Not enough to worry about in SQL Server; in DB2, it is a good idea to
put varying length coloumns toward the end of the row, however. Know
your product and be aware of the Standards and the rest of the world so
you do not think that your current dialect is a "law of Nature".

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:17 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com