|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, April 22, 2013 2:31 AM
Points: 199,
Visits: 205
|
|
GilaMonster (7/4/2012)
For seeking, for range scans, for supporting an order by.
Oh, I didn't have the ORDER BY clause in mind yet. Thanks, it's more clearly now.
So, if I my query returns the records in the descending order - it is better to create the index column also in the same order ("DESC"), right?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 7:27 AM
Points: 1,259,
Visits: 4,260
|
|
GilaMonster (7/4/2012) For seeking, for range scans, for supporting an order by. Not ever for returning rows in the index order without an order by specified. That was quoted a bit out of context (context being ordering of returned rows without an order by)
Would it potentially make a difference to the amount of fragmentation caused by adding new items to the index? e.g. if your index key is a value that will generally *decrease*, would you get a less fragmented index by declaring it DESC?
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:18 PM
Points: 37,744,
Visits: 30,025
|
|
Maybe. Will it be a big difference and will the reduction in fragmentation affect query performance? Depends on other factors (frequency of inserts, type of queries, etc)
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|