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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| "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/ |
| |||
| 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 |
| ||||
| >> 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". |