赞
踩
mysql 文档中对于索引定义中,ASC 和 DESC 的描述
MySQL < 8.0A key_part specification can end with ASC or DESC. These keywords are permitted for future extensions for specifying ascending or descending index value storage.
Currently, they are parsed but ignored; index values are always stored in ascending order.
MySQL >= 8.0A key_part specification can end with ASC or DESC to specify whether index values are stored in ascending or descending order. The default is ascending if no order specifier is given. ASC and DESC are not permitted for HASH indexes. As of MySQL 8.0.12, ASC and DESC are not permitted for SPATIAL indexes.
所以,在8.0之前的版本中, DESC 是无效的,索引 (a ASC, b DESC, c DESC) 等于 (a ASC, b ASC, c ASC),故而无法使用整个联合索引进行排序。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。