mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Limit calculated rows to the number of rows in the table
The result file changes are mainly that number of rows is one smaller for some queries with DISTINCT or GROUP BY
This commit is contained in:
@ -538,10 +538,10 @@ PRIMARY KEY (a,b));
|
||||
INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
|
||||
EXPLAIN SELECT DISTINCT a FROM t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range NULL PRIMARY 4 NULL 4 Using index for group-by
|
||||
1 SIMPLE t2 range NULL PRIMARY 4 NULL 3 Using index for group-by
|
||||
EXPLAIN SELECT DISTINCT a,a FROM t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range NULL PRIMARY 4 NULL 4 Using index for group-by
|
||||
1 SIMPLE t2 range NULL PRIMARY 4 NULL 3 Using index for group-by
|
||||
EXPLAIN SELECT DISTINCT b,a FROM t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
|
||||
@ -756,7 +756,7 @@ INSERT INTO t1(a, b, c) VALUES (1, 1, 1),
|
||||
(1, 2, 3);
|
||||
EXPLAIN SELECT DISTINCT a, b, d, c FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL PRIMARY 16 NULL 7 Using index for group-by; Using temporary
|
||||
1 SIMPLE t1 range NULL PRIMARY 16 NULL 6 Using index for group-by; Using temporary
|
||||
SELECT DISTINCT a, b, d, c FROM t1;
|
||||
a b d c
|
||||
1 1 0 1
|
||||
|
Reference in New Issue
Block a user