SQL Index Performance - ASC vs DESC

前端 未结 4 683
花落未央
花落未央 2021-01-01 14:07

I\'ve got a user table keyed on an auto-increment int column that looks something like this:

CREATE TABLE `user_def` (
  `user_id` int(11) NOT NULL AUTO_INC         


        
4条回答
  •  庸人自扰
    2021-01-01 14:58

    Someday I've been given by simple yet brilliant trick, how to make a descending index for mysql: Just by adding another column with negative (mirror value). Say, for the unsigned int it would be just value*-1 - so, it works for the unix timestamps.
    For varchars the idea is similar but implementation is a bit more complex.

提交回复
热议问题