Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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

asked 20 May '11, 12:34

Martin's gravatar image

Martin
9.1k130170257
accept rate: 14%

edited 21 May '11, 17:52

Volker%20Barth's gravatar image

Volker Barth
40.4k363552825


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.

permanent link

answered 20 May '11, 13:17

Mark%20Culp's gravatar image

Mark Culp
25.0k10142298
accept rate: 41%

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.

permanent link

answered 21 May '11, 17:44

Volker%20Barth's gravatar image

Volker Barth
40.4k363552825
accept rate: 34%

edited 21 May '11, 17:52

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×275
×32

question asked: 20 May '11, 12:34

question was seen: 2,888 times

last updated: 21 May '11, 17:52