[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.
|