Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Clone in Desktop Download ZIP

Loading…

Range in form tbl.key >= const doesn't work in reverse column family #36

Closed
spetrunia opened this Issue · 1 comment

1 participant

@spetrunia
Collaborator

This is a continuation of issue #16.

Run this

create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;

create table t2 (
  pk int not null,
  a  int not null,
  b  int not null,
  primary key(pk),
  key(a) comment 'rev:cf1'
) engine=rocksdb;
insert into t2 select A.a, FLOOR(A.a/10), A.a from t1 A;

The problem query:

MySQL [test]> explain select * from t2 force index (a) where a>=0;
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
| id | select_type | table | type  | possible_keys | key  | key_len | ref  | rows | Extra       |
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|  1 | SIMPLE      | t2    | range | a             | a    | 4       | NULL |   10 | Using where |
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
1 row in set (0.01 sec)

MySQL [test]> select * from t2 force index (a) where a>=0;
Empty set (0.01 sec)

The correct result is

MySQL [test]> select * from t2 ignore index (a) where a>=0;
+-----+----+-----+
| pk  | a  | b   |
+-----+----+-----+
|   0 |  0 |   0 |
|   1 |  0 |   1 |
|   2 |  0 |   2 |
|   3 |  0 |   3 |
|   4 |  0 |   4 |
|   5 |  0 |   5 |
.. (total 1000 rows)
@spetrunia spetrunia added the bug label
@spetrunia spetrunia self-assigned this
@spetrunia spetrunia added this to the high-pri milestone
@spetrunia spetrunia closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.