mirror of
https://github.com/MariaDB/server.git
synced 2025-11-21 06:21:35 +03:00
MWL#90: Merge (4)
This commit is contained in:
@@ -1735,12 +1735,18 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
1
|
||||
1
|
||||
# MariaDB note:
|
||||
# This will show 2 for table which has 5 rows.
|
||||
# This is because the access method employed is actually range access
|
||||
# which scans 2 records (yes, EXPLAIN displays it incorrectly).
|
||||
# our correct printing is an artifact of changing in select_describe()
|
||||
# from printing table->starts.records() to tab->records.
|
||||
EXPLAIN
|
||||
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t1 index c3,c2 c2 10 NULL 5
|
||||
2 DERIVED t1 index c3,c2 c2 10 NULL 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
|
||||
ENGINE=InnoDB;
|
||||
@@ -1749,12 +1755,13 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
1
|
||||
1
|
||||
# See above "MariaDB note"
|
||||
EXPLAIN
|
||||
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t1 index c3,c2 c2 18 NULL 5
|
||||
2 DERIVED t1 index c3,c2 c2 18 NULL 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
|
||||
KEY (c3), KEY (c2, c3))
|
||||
@@ -1764,12 +1771,13 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
1
|
||||
1
|
||||
# See above "MariaDB note"
|
||||
EXPLAIN
|
||||
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
|
||||
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t1 index c3,c2 c2 14 NULL 5
|
||||
2 DERIVED t1 index c3,c2 c2 14 NULL 2
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
drop table if exists t1, t2, t3;
|
||||
|
||||
Reference in New Issue
Block a user