Question : Database Design and Indexes

Hi Guys and Gals

If I have a table in MSSQL2008 database containing approximately 40 columns.
and + 1 million plus rows, it grows by about 30k rows per day.

I need to query the table using an index across two columns:
ContactId INT NOT NULL and
JobNumber INT NOT NULL

1) Will the index be more efficent if the two columns ContactId and JobNumber are physically next to each other in the database table ?

2) Given the number of new Contacts being added daily, will it be quicker to rebuild indexes if the two columns are physically close, or will it make no difference if they are separated by 30 or more other columns ?

3) I assume you can only rebuild indexes when users are not access the data, and if so, then the indexes may only be re-built after production hours, I am therefore concerned that during the daytime all newly inserted records will effectively be un-indexed, is this a valid concern ?

Many thanks for your help.

Answer : Database Design and Indexes

1) & 2) As fields are not stored internally in a position relevant way I'll say that there will be no difference between the position of the index fields in the table. However I tend to put indexes in the first fields by convention.

3) Rebuilding indexes is a heavy task that will have a negative impact in your app's performance, so it's a good idea to launch rebuilds out of production hours. The newly inserted rows in your DB are below 3% each day, so your searchs will lose about a 3% in performance each day until you rebuild your indexes. This is not such a big deal if you rebuild them in a daily basis.
Random Solutions  
 
programming4us programming4us