Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2017
    Posts
    1

    Post Unanswered: sybase multiple column vs multiple index

    Hi,

    While working on my project i came by a situation where i need to add one culumn to unique clustered index and by doing that lot of my procs and views became very slow.

    structure of my table is like
    A, B, valid_to , valid_from , C, D....

    //index now
    unique cluster index|(A, B, valid_to, valid_from)

    //index previously
    unique cluster index|(A, valid_to, valid_from)

    now my question is, should i create one more index like below, so that all the query which is using this will work as it is
    non-clustered index(A, Valid_to, valid_from)

    or create only one clustered index like below, i have seen this way in couple of other website as well but i was not sure if this works inn sysbase unique cluster index|(A, valid_to, valid_from, B)

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,863
    Provided Answers: 17
    The order of the columns in an index does not need to be the same as the order of the columns in the table. I am guessing that most of your queries do not specify B as a condition, so the index is getting passed over. Creating the index as (A, valid_to, valid_from, B) should work for you, as this will be the least invasive change to the index. This should be done on a test server first, of course. If in the future your queries do begin specifying B as a condition, you may need to re-visit this index definition.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •