cancel
Showing results for 
Search instead for 
Did you mean: 

Is it useful to have ascending + descending index?

MCMartin
Participant
3,177

Is it usefull to have an ascending and a descending index on the same column?

Accepted Solutions (1)

Accepted Solutions (1)

MarkCulp
Participant

No, there is no need to define both an ascending column index and a descending index on the column. One or the other is sufficient and the SQL Anywhere server will perform a reverse index scan in cases that it makes sense to do so.

Answers (1)

Answers (1)

VolkerBarth
Contributor

Just to add to Mark's sound answer (though Martin seems to refer to a single-column index):

The situation would be different if the index is a composite one (i.e. is built over 2 or more columns). Then not only the columns's order in the index (colA, colB vs. colB, colA), but also their according sort order will make a difference (colA ASC, colB ASC vs. colA ASC, colB DESC).

Cf. the docs.