2

Possible Duplicate:
Is there any reason to worry about the column order in a table?

Let's say I have a big table, 7 million rows. current structure is:

ID (primary key, auto inc, int), some fixed columns, some variable columns (varchars).

All queries are done using a specific ID. The variable columns are required twice as often.

Should I change it so that variable columns are at the beginning, just after the ID?

reason for: since they are used most, hence if they are first, does this make queries that need to get just them faster? reason against: they are variable columns, so their size will vary. if they are before the fixed columns, can this throw off the fixed columns, making access to them slower?

Community
  • 1
  • 1
David19801
  • 11,214
  • 25
  • 84
  • 127
  • You have posted one question every fourth hour now for several days, and all of them seem to be related to this tiny 7 million row table. While the questions are interesting, may I offer an advice before you have spent all of the project budget on premature optimization? Generate 7 million rows of test data and measure. It takes less than 20 minutes to do it. Probably an hour or two to come up with a way to generate data that mimic actual data patterns and distributions. – Ronnis Dec 29 '10 at 12:16
  • Hi Ronnie, I find your statement incredibly rude. This is a website to ask questions that you would like answers to and to answer questions for others. It is better if you don't measure my posting and work on your website more please. Thanks. – David19801 Dec 29 '10 at 15:36

0 Answers0