The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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
8.6k114149237
accept rate: 14%

edited 21 May '11, 17:52

Volker%20Barth's gravatar image

Volker Barth
29.3k287438645


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
22.3k9129262
accept rate: 40%

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
29.3k287438645
accept rate: 32%

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:

×238
×25

question asked: 20 May '11, 12:34

question was seen: 1,097 times

last updated: 21 May '11, 17:52