本文介绍在 OceanBase 数据库中如何使用逆序索引。
影响版本
OceanBase 数据库V2.X 及以前版本
问题现象
OceanBase 数据库V2.X 及以前版本不支持逆序索引,通过以下三种方式创建逆序索引均会报错。
创建表时指定逆序索引。
mysql> create table test (c1 int, c2 int, index idx (c1 DESC));创建表的索引时指定逆序索引。
mysql> create index idx on test (c1 desc) local;添加索引到表上时指定逆序索引。
mysql> alter table test add index (c1 desc) local;
以上三种情况下,会产生以下错误。
ERROR 1235 (0A000): Not supported feature or function
规避方式
不建议在 OceanBase 数据库中使用逆序索引。