MySQL Forums
Forum List  »  General

Re: Using an ENUM column in an index
Posted by: Rick James
Date: March 18, 2015 06:12PM

If ord is always 4 characters, I would not worry about ENUM, simply do CHAR(4) CHARACTER SET ASCII.

Or is the question that the enum has some 'hidden' ordering?? If so, then:

Plan A: Have another table that maps `ord` to the order.

Plan B: Use ORDER BY ..., FIND_IN_SET('0401,ABCD,0403,XYZZ')

In any case, there is no requirement that everything in the ORDER BY be in an INDEX. So, as Peter suggests, leave it off the INDEX. Then focus on getting the ORDER BY to work.

Options: ReplyQuote


Subject
Written By
Posted
Re: Using an ENUM column in an index
March 18, 2015 06:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.