View Single Post
Old 05-05-2004, 10:33 AM   #1 (permalink)
Stompy
Banned from being Banned
 
Location: Donkey
[SQL Server] Do positions of columns/fields affect performance?

Say I have a table with 10 fields. The very last field has a data type of DateTime, which I frequently perform searches with.

In addition to indexing, would it make the query faster if I repositioned that field (in the table's design) so that it was in the front? Instead of being:

Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9, DateField

It would be:

DateField, Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9


Kind of a silly question, but I always wondered if field positioning had any effect on how well a query performed. In theory it makes sense because if that date field was at the front as opposed to being behind 9 other fields, it seems the DB wouldn't have to sift through as much data to find what it needs.

On the otherhand.. I have no idea how a DB actually performs the searches, so it might not matter. Just wanted additional input on this.

Thanks!
__________________
I love lamp.
Stompy is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38