Debian Codegraph @

mysql-test/suite/innodb/t/count_distinct.test

raw
1 --source include/have_innodb.inc
2
3 #
4 # MDEV-4925 Wrong result - count(distinct), Using index for group-by (scanning)
5 #
6 CREATE TABLE t1 (
7 id int NOT NULL AUTO_INCREMENT,
8 a int NOT NULL,
9 b int NOT NULL,
10 PRIMARY KEY (id),
11 UNIQUE KEY ba (b, a)
12 ) ENGINE=InnoDB;
13 INSERT INTO t1 (a, b) VALUES(1,101),(1,102),(1,103),(1,104),(1,105),(1,106),(1,107),(1,108),(1,109),(1,110);
14 SELECT COUNT(DISTINCT b) FROM t1 WHERE a = 1;
15 DROP TABLE t1;