5.3->5.5 merge
This commit is contained in:
commit
effed09bd7
@ -76,6 +76,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
|||||||
../sql/sql_tablespace.cc ../sql/sql_table.cc ../sql/sql_test.cc
|
../sql/sql_tablespace.cc ../sql/sql_table.cc ../sql/sql_test.cc
|
||||||
../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
|
../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
|
||||||
../sql/sql_update.cc ../sql/sql_view.cc ../sql/sql_profile.cc
|
../sql/sql_update.cc ../sql/sql_view.cc ../sql/sql_profile.cc
|
||||||
|
../sql/gcalc_tools.cc ../sql/gcalc_slicescan.cc
|
||||||
../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
|
../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
|
||||||
../sql/sql_time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
|
../sql/sql_time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
|
||||||
../sql/partition_info.cc ../sql/sql_connect.cc
|
../sql/partition_info.cc ../sql/sql_connect.cc
|
||||||
|
@ -236,7 +236,7 @@ explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelo
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
|
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
|
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
|
||||||
SELECT fid, X(g) FROM gis_point ORDER by fid;
|
SELECT fid, X(g) FROM gis_point ORDER by fid;
|
||||||
fid X(g)
|
fid X(g)
|
||||||
101 10
|
101 10
|
||||||
@ -253,7 +253,7 @@ explain extended select X(g),Y(g) FROM gis_point;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
|
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
|
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
|
||||||
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
|
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
|
||||||
fid AsText(StartPoint(g))
|
fid AsText(StartPoint(g))
|
||||||
105 POINT(0 0)
|
105 POINT(0 0)
|
||||||
@ -288,7 +288,7 @@ explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),Num
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
|
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
|
||||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||||
fid AsText(Centroid(g))
|
fid AsText(Centroid(g))
|
||||||
108 POINT(15 15)
|
108 POINT(15 15)
|
||||||
@ -318,7 +318,7 @@ explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumI
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
|
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
|
||||||
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
|
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
|
||||||
fid IsClosed(g)
|
fid IsClosed(g)
|
||||||
114 0
|
114 0
|
||||||
@ -357,7 +357,7 @@ explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
|
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
|
||||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
|
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
|
||||||
fid AsText(GeometryN(g, 2))
|
fid AsText(GeometryN(g, 2))
|
||||||
111 POINT(10 10)
|
111 POINT(10 10)
|
||||||
@ -385,17 +385,17 @@ explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
|
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
|
||||||
SELECT g1.fid as first, g2.fid as second,
|
SELECT g1.fid as first, g2.fid as second,
|
||||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 1 1 0
|
||||||
120 121 0 0 1 0 0 0 1 0
|
120 121 0 0 1 0 0 0 1 0
|
||||||
121 120 0 0 1 0 0 0 1 0
|
121 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 1 1 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||||
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
|
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
|
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
|
||||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
a INTEGER PRIMARY KEY AUTO_INCREMENT,
|
a INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||||
@ -494,7 +494,7 @@ mbroverlaps
|
|||||||
down,left,right,up
|
down,left,right,up
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
mbrtouches
|
mbrtouches
|
||||||
down2,left2,right2,up2
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
mbrwithin
|
mbrwithin
|
||||||
big,center
|
big,center
|
||||||
@ -515,7 +515,7 @@ overlaps
|
|||||||
down,left,right,up
|
down,left,right,up
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
touches
|
touches
|
||||||
down2,left2,right2,up2
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
within
|
within
|
||||||
big,center
|
big,center
|
||||||
|
@ -113,7 +113,7 @@ insert into t1 (b) values ("hello"),("my"),("world");
|
|||||||
create table t2 (key (b)) select * from t1;
|
create table t2 (key (b)) select * from t1;
|
||||||
explain select * from t2 where b="world";
|
explain select * from t2 where b="world";
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref B B 21 const 1 Using where
|
1 SIMPLE t2 ref B B 21 const 1 Using index condition
|
||||||
select * from t2 where b="world";
|
select * from t2 where b="world";
|
||||||
a B
|
a B
|
||||||
3 world
|
3 world
|
||||||
|
@ -1184,7 +1184,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
||||||
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
||||||
30
|
31
|
||||||
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@ -2761,11 +2761,11 @@ KEY(date_column));
|
|||||||
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition
|
||||||
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
||||||
|
@ -596,31 +596,31 @@ INSERT INTO t1 VALUES ('i','i');
|
|||||||
INSERT INTO t1 VALUES ('j','j');
|
INSERT INTO t1 VALUES ('j','j');
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s1='a';
|
EXPLAIN SELECT * FROM t1 WHERE s1='a';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref s1 s1 11 const 1 Using where
|
1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s2='a';
|
EXPLAIN SELECT * FROM t1 WHERE s2='a';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref s2 s2 11 const 1 Using where
|
1 SIMPLE t1 ref s2 s2 11 const 1 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
|
EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref s1 s1 11 const 1 Using where
|
1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
|
EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
|
EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
|
1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
|
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
|
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
|
1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
|
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
|
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range s1 s1 11 NULL 1 Using where
|
1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
|
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||||
|
@ -1576,7 +1576,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
||||||
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
||||||
30
|
31
|
||||||
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@ -3153,11 +3153,11 @@ KEY(date_column));
|
|||||||
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition
|
||||||
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
||||||
|
@ -1603,7 +1603,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
||||||
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
||||||
30
|
31
|
||||||
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@ -3180,11 +3180,11 @@ KEY(date_column));
|
|||||||
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition
|
||||||
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
||||||
|
@ -2486,7 +2486,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
||||||
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
||||||
0030
|
0031
|
||||||
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@ -4063,11 +4063,11 @@ KEY(date_column));
|
|||||||
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition
|
||||||
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
||||||
|
@ -3318,7 +3318,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
|
||||||
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
|
||||||
30
|
31
|
||||||
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@ -4895,11 +4895,11 @@ KEY(date_column));
|
|||||||
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition
|
||||||
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
||||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
|
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
|
||||||
|
@ -778,7 +778,7 @@ DROP TABLE t1;
|
|||||||
#
|
#
|
||||||
# LP bug #803851: materialized view + IN->EXISTS
|
# LP bug #803851: materialized view + IN->EXISTS
|
||||||
#
|
#
|
||||||
SET SESSION optimizer_switch='semijoin=off,derived_with_keys=on';
|
SET SESSION optimizer_switch='semijoin=off,derived_with_keys=on,materialization=off';
|
||||||
CREATE TABLE t1 (a int, b int);
|
CREATE TABLE t1 (a int, b int);
|
||||||
INSERT INTO t1 VALUES (2,2), (3,3), (1,1);
|
INSERT INTO t1 VALUES (2,2), (3,3), (1,1);
|
||||||
CREATE TABLE t2 (a int);
|
CREATE TABLE t2 (a int);
|
||||||
@ -1448,7 +1448,7 @@ KEY (c,a) , PRIMARY KEY (a)
|
|||||||
INSERT INTO t3 VALUES
|
INSERT INTO t3 VALUES
|
||||||
(14,4,'a'), (15,7,'b'), (16,4,'c'), (17,1,'d'), (18,9,'e'),
|
(14,4,'a'), (15,7,'b'), (16,4,'c'), (17,1,'d'), (18,9,'e'),
|
||||||
(19,4,'f'), (20,8,'g');
|
(19,4,'f'), (20,8,'g');
|
||||||
SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off';
|
SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off,materialization=off';
|
||||||
# The following two EXPLAINs must return the same execution plan
|
# The following two EXPLAINs must return the same execution plan
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 , t2
|
SELECT * FROM t1 , t2
|
||||||
|
@ -13,7 +13,7 @@ id str
|
|||||||
3 foo
|
3 foo
|
||||||
explain select * from t1 where str is null;
|
explain select * from t1 where str is null;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref str str 11 const 1 Using where
|
1 SIMPLE t1 ref str str 11 const 1 Using index condition
|
||||||
explain select * from t1 where str="foo";
|
explain select * from t1 where str="foo";
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const str str 11 const 1
|
1 SIMPLE t1 const str str 11 const 1
|
||||||
|
@ -103,7 +103,6 @@ foo
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1259 ZLIB: Input data corrupted
|
Warning 1259 ZLIB: Input data corrupted
|
||||||
Warning 1259 ZLIB: Input data corrupted
|
Warning 1259 ZLIB: Input data corrupted
|
||||||
Warning 1259 ZLIB: Input data corrupted
|
|
||||||
explain select *, uncompress(a) from t1;
|
explain select *, uncompress(a) from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||||
|
@ -241,7 +241,7 @@ insert into t2 select C.a*2+1, 'yes' from t1 C;
|
|||||||
explain
|
explain
|
||||||
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
|
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range a a 5 NULL 12 Using where
|
1 SIMPLE t2 range a a 5 NULL 12 Using index condition
|
||||||
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
|
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
|
||||||
a filler
|
a filler
|
||||||
1 yes
|
1 yes
|
||||||
@ -256,10 +256,10 @@ a filler
|
|||||||
19 yes
|
19 yes
|
||||||
explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2);
|
explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range a a 5 NULL 912 Using where
|
1 SIMPLE t2 range a a 5 NULL 912 Using index condition
|
||||||
explain select * from t2 force index(a) where a <> 2;
|
explain select * from t2 force index(a) where a <> 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range a a 5 NULL 912 Using where
|
1 SIMPLE t2 range a a 5 NULL 912 Using index condition
|
||||||
drop table t2;
|
drop table t2;
|
||||||
create table t2 (a datetime, filler char(200), key(a));
|
create table t2 (a datetime, filler char(200), key(a));
|
||||||
insert into t2 select '2006-04-25 10:00:00' + interval C.a minute,
|
insert into t2 select '2006-04-25 10:00:00' + interval C.a minute,
|
||||||
@ -271,7 +271,7 @@ select * from t2 where a NOT IN (
|
|||||||
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
|
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
|
||||||
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
|
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range a a 9 NULL 18 Using where
|
1 SIMPLE t2 range a a 9 NULL 18 Using index condition
|
||||||
select * from t2 where a NOT IN (
|
select * from t2 where a NOT IN (
|
||||||
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
|
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
|
||||||
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
|
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
|
||||||
@ -295,7 +295,7 @@ insert into t2 values ('fon', '1'), ('fop','1'), ('barbaq','1'),
|
|||||||
('barbas','1'), ('bazbazbay', '1'),('zz','1');
|
('barbas','1'), ('bazbazbay', '1'),('zz','1');
|
||||||
explain select * from t2 where a not in('foo','barbar', 'bazbazbaz');
|
explain select * from t2 where a not in('foo','barbar', 'bazbazbaz');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range a a 13 NULL 7 Using where
|
1 SIMPLE t2 range a a 13 NULL 7 Using index condition
|
||||||
drop table t2;
|
drop table t2;
|
||||||
create table t2 (a decimal(10,5), filler char(200), key(a));
|
create table t2 (a decimal(10,5), filler char(200), key(a));
|
||||||
insert into t2 select 345.67890, 'no' from t1 A, t1 B;
|
insert into t2 select 345.67890, 'no' from t1 A, t1 B;
|
||||||
@ -306,7 +306,7 @@ insert into t2 values (0, '1'), (22334.123,'1'), (33333,'1'),
|
|||||||
explain
|
explain
|
||||||
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
|
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range a a 7 NULL 7 Using where
|
1 SIMPLE t2 range a a 7 NULL 7 Using index condition
|
||||||
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
|
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
|
||||||
a filler
|
a filler
|
||||||
0.00000 1
|
0.00000 1
|
||||||
@ -630,16 +630,16 @@ INSERT INTO t1 (c_int) SELECT 0 FROM t1;
|
|||||||
INSERT INTO t1 (c_int) SELECT 0 FROM t1;
|
INSERT INTO t1 (c_int) SELECT 0 FROM t1;
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
|
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
|
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
|
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
|
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -648,10 +648,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using where
|
1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using where
|
1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -660,10 +660,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_float c_float 4 NULL 3 Using where
|
1 SIMPLE t1 range c_float c_float 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_float c_float 4 NULL 3 Using where
|
1 SIMPLE t1 range c_float c_float 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -672,10 +672,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using where
|
1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using where
|
1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -685,11 +685,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT * FROM t1 WHERE c_date
|
EXPLAIN SELECT * FROM t1 WHERE c_date
|
||||||
IN ('2009-09-01', '2009-09-02', '2009-09-03');
|
IN ('2009-09-01', '2009-09-02', '2009-09-03');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_date c_date 3 NULL 3 Using where
|
1 SIMPLE t1 range c_date c_date 3 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_date
|
EXPLAIN SELECT * FROM t1 WHERE c_date
|
||||||
IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03');
|
IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_date c_date 3 NULL 3 Using where
|
1 SIMPLE t1 range c_date c_date 3 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -699,11 +699,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT * FROM t1 WHERE c_datetime
|
EXPLAIN SELECT * FROM t1 WHERE c_datetime
|
||||||
IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
|
IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using where
|
1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_datetime
|
EXPLAIN SELECT * FROM t1 WHERE c_datetime
|
||||||
IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
|
IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using where
|
1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -713,11 +713,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
||||||
IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using where
|
1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
EXPLAIN SELECT * FROM t1 WHERE c_timestamp
|
||||||
IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using where
|
1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -726,10 +726,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_year c_year 1 NULL 3 Using where
|
1 SIMPLE t1 range c_year c_year 1 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3);
|
EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_year c_year 1 NULL 3 Using where
|
1 SIMPLE t1 range c_year c_year 1 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
@ -738,10 +738,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3');
|
EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_char c_char 10 NULL 3 Using where
|
1 SIMPLE t1 range c_char c_char 10 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3');
|
EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c_char c_char 10 NULL 3 Using where
|
1 SIMPLE t1 range c_char c_char 10 NULL 3 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL);
|
EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
|
@ -1154,7 +1154,6 @@ notnumber 0
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
|
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
|
||||||
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
|
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
|
||||||
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
|
|
||||||
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
|
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
|
||||||
str num
|
str num
|
||||||
notnumber 0
|
notnumber 0
|
||||||
|
436
mysql-test/r/gis-precise.result
Normal file
436
mysql-test/r/gis-precise.result
Normal file
File diff suppressed because one or more lines are too long
49
mysql-test/r/gis-rt-precise.result
Normal file
49
mysql-test/r/gis-rt-precise.result
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
g GEOMETRY NOT NULL,
|
||||||
|
SPATIAL KEY(g)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`fid` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`g` geometry NOT NULL,
|
||||||
|
PRIMARY KEY (`fid`),
|
||||||
|
SPATIAL KEY `g` (`g`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
SELECT count(*) FROM t1;
|
||||||
|
count(*)
|
||||||
|
150
|
||||||
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 140))'));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range g g 34 NULL 8 Using where
|
||||||
|
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
|
fid AsText(g)
|
||||||
|
11 LINESTRING(140 140,160 160)
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
g GEOMETRY NOT NULL
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
ALTER TABLE t1 ADD SPATIAL KEY(g);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`fid` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`g` geometry NOT NULL,
|
||||||
|
PRIMARY KEY (`fid`),
|
||||||
|
SPATIAL KEY `g` (`g`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
|
||||||
|
SELECT count(*) FROM t1;
|
||||||
|
count(*)
|
||||||
|
100
|
||||||
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
|
||||||
|
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range g g 34 NULL 1 Using where
|
||||||
|
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
|
||||||
|
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
|
||||||
|
fid AsText(g)
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.5 tests.
|
@ -12,6 +12,156 @@ t1 CREATE TABLE `t1` (
|
|||||||
PRIMARY KEY (`fid`),
|
PRIMARY KEY (`fid`),
|
||||||
SPATIAL KEY `g` (`g`)
|
SPATIAL KEY `g` (`g`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(147 147, 153 153)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(146 146, 154 154)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(145 145, 155 155)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(144 144, 156 156)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(143 143, 157 157)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(142 142, 158 158)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(141 141, 159 159)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(140 140, 160 160)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(139 139, 161 161)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(138 138, 162 162)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(137 137, 163 163)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(136 136, 164 164)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(135 135, 165 165)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(134 134, 166 166)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(133 133, 167 167)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(132 132, 168 168)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(131 131, 169 169)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(130 130, 170 170)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(129 129, 171 171)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(128 128, 172 172)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(127 127, 173 173)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(126 126, 174 174)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(125 125, 175 175)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(124 124, 176 176)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(123 123, 177 177)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(122 122, 178 178)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(121 121, 179 179)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(120 120, 180 180)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(119 119, 181 181)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(118 118, 182 182)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(117 117, 183 183)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(116 116, 184 184)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(115 115, 185 185)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(114 114, 186 186)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(113 113, 187 187)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(112 112, 188 188)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(111 111, 189 189)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(110 110, 190 190)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(109 109, 191 191)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(108 108, 192 192)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(107 107, 193 193)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(106 106, 194 194)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(105 105, 195 195)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(104 104, 196 196)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(103 103, 197 197)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(102 102, 198 198)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(101 101, 199 199)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(100 100, 200 200)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(99 99, 201 201)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(98 98, 202 202)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(97 97, 203 203)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(96 96, 204 204)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(95 95, 205 205)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(94 94, 206 206)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(93 93, 207 207)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(92 92, 208 208)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(91 91, 209 209)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(90 90, 210 210)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(89 89, 211 211)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(88 88, 212 212)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(87 87, 213 213)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(86 86, 214 214)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(85 85, 215 215)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(84 84, 216 216)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(83 83, 217 217)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(82 82, 218 218)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(81 81, 219 219)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(80 80, 220 220)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(79 79, 221 221)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(78 78, 222 222)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(77 77, 223 223)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(76 76, 224 224)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(75 75, 225 225)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(74 74, 226 226)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(73 73, 227 227)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(72 72, 228 228)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(71 71, 229 229)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(70 70, 230 230)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(69 69, 231 231)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(68 68, 232 232)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(67 67, 233 233)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(66 66, 234 234)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(65 65, 235 235)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(64 64, 236 236)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(63 63, 237 237)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(62 62, 238 238)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(61 61, 239 239)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(60 60, 240 240)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(59 59, 241 241)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(58 58, 242 242)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(57 57, 243 243)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(56 56, 244 244)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(55 55, 245 245)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(54 54, 246 246)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(53 53, 247 247)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(52 52, 248 248)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(51 51, 249 249)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(50 50, 250 250)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(49 49, 251 251)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(48 48, 252 252)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(47 47, 253 253)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(46 46, 254 254)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(45 45, 255 255)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(44 44, 256 256)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(43 43, 257 257)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(42 42, 258 258)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(41 41, 259 259)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(40 40, 260 260)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(39 39, 261 261)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(38 38, 262 262)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(37 37, 263 263)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(36 36, 264 264)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(35 35, 265 265)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(34 34, 266 266)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(33 33, 267 267)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(32 32, 268 268)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(31 31, 269 269)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(30 30, 270 270)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(29 29, 271 271)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(28 28, 272 272)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(27 27, 273 273)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(26 26, 274 274)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(25 25, 275 275)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(24 24, 276 276)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(23 23, 277 277)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(22 22, 278 278)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(21 21, 279 279)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(20 20, 280 280)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(19 19, 281 281)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(18 18, 282 282)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(17 17, 283 283)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(16 16, 284 284)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(15 15, 285 285)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(14 14, 286 286)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(13 13, 287 287)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(12 12, 288 288)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(11 11, 289 289)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(10 10, 290 290)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(9 9, 291 291)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(8 8, 292 292)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(7 7, 293 293)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(6 6, 294 294)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(5 5, 295 295)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(4 4, 296 296)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(3 3, 297 297)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(2 2, 298 298)'));
|
||||||
|
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 1, 299 299)'));
|
||||||
SELECT count(*) FROM t1;
|
SELECT count(*) FROM t1;
|
||||||
count(*)
|
count(*)
|
||||||
150
|
150
|
||||||
@ -20,22 +170,112 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 range g g 34 NULL 8 Using where
|
1 SIMPLE t1 range g g 34 NULL 8 Using where
|
||||||
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
1 LINESTRING(150 150,150 150)
|
|
||||||
3 LINESTRING(148 148,152 152)
|
|
||||||
4 LINESTRING(147 147,153 153)
|
|
||||||
5 LINESTRING(146 146,154 154)
|
|
||||||
6 LINESTRING(145 145,155 155)
|
|
||||||
7 LINESTRING(144 144,156 156)
|
|
||||||
8 LINESTRING(143 143,157 157)
|
|
||||||
9 LINESTRING(142 142,158 158)
|
|
||||||
10 LINESTRING(141 141,159 159)
|
|
||||||
11 LINESTRING(140 140,160 160)
|
11 LINESTRING(140 140,160 160)
|
||||||
2 LINESTRING(149 149,151 151)
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
g GEOMETRY NOT NULL
|
g GEOMETRY NOT NULL
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)));
|
||||||
|
INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)));
|
||||||
ALTER TABLE t2 ADD SPATIAL KEY(g);
|
ALTER TABLE t2 ADD SPATIAL KEY(g);
|
||||||
SHOW CREATE TABLE t2;
|
SHOW CREATE TABLE t2;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@ -51,212 +291,408 @@ count(*)
|
|||||||
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range g g 34 NULL 4 Using where
|
1 SIMPLE t2 range g g 34 NULL 1 Using where
|
||||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
46 LINESTRING(51 41,60 50)
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
|
||||||
56 LINESTRING(41 41,50 50)
|
SELECT count(*) FROM t2;
|
||||||
45 LINESTRING(51 51,60 60)
|
|
||||||
55 LINESTRING(41 51,50 60)
|
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
|
||||||
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
100
|
100
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
|
@ -66,7 +66,9 @@ INSERT INTO gis_multi_polygon VALUES
|
|||||||
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
|
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
|
||||||
INSERT INTO gis_geometrycollection VALUES
|
INSERT INTO gis_geometrycollection VALUES
|
||||||
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
||||||
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
|
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
|
||||||
|
(122, GeomFromText('GeometryCollection()')),
|
||||||
|
(123, GeomFromText('GeometryCollection EMPTY'));
|
||||||
INSERT into gis_geometry SELECT * FROM gis_point;
|
INSERT into gis_geometry SELECT * FROM gis_point;
|
||||||
INSERT into gis_geometry SELECT * FROM gis_line;
|
INSERT into gis_geometry SELECT * FROM gis_line;
|
||||||
INSERT into gis_geometry SELECT * FROM gis_polygon;
|
INSERT into gis_geometry SELECT * FROM gis_polygon;
|
||||||
@ -109,6 +111,8 @@ SELECT fid, AsText(g) FROM gis_geometrycollection;
|
|||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
|
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
|
||||||
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
||||||
|
122 GEOMETRYCOLLECTION EMPTY
|
||||||
|
123 GEOMETRYCOLLECTION EMPTY
|
||||||
SELECT fid, AsText(g) FROM gis_geometry;
|
SELECT fid, AsText(g) FROM gis_geometry;
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
101 POINT(10 10)
|
101 POINT(10 10)
|
||||||
@ -132,6 +136,8 @@ fid AsText(g)
|
|||||||
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
|
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
|
||||||
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
|
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
|
||||||
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
||||||
|
122 GEOMETRYCOLLECTION EMPTY
|
||||||
|
123 GEOMETRYCOLLECTION EMPTY
|
||||||
SELECT fid, Dimension(g) FROM gis_geometry;
|
SELECT fid, Dimension(g) FROM gis_geometry;
|
||||||
fid Dimension(g)
|
fid Dimension(g)
|
||||||
101 0
|
101 0
|
||||||
@ -155,6 +161,8 @@ fid Dimension(g)
|
|||||||
119 2
|
119 2
|
||||||
120 1
|
120 1
|
||||||
121 1
|
121 1
|
||||||
|
122 0
|
||||||
|
123 0
|
||||||
SELECT fid, GeometryType(g) FROM gis_geometry;
|
SELECT fid, GeometryType(g) FROM gis_geometry;
|
||||||
fid GeometryType(g)
|
fid GeometryType(g)
|
||||||
101 POINT
|
101 POINT
|
||||||
@ -178,6 +186,8 @@ fid GeometryType(g)
|
|||||||
119 MULTIPOLYGON
|
119 MULTIPOLYGON
|
||||||
120 GEOMETRYCOLLECTION
|
120 GEOMETRYCOLLECTION
|
||||||
121 GEOMETRYCOLLECTION
|
121 GEOMETRYCOLLECTION
|
||||||
|
122 GEOMETRYCOLLECTION
|
||||||
|
123 GEOMETRYCOLLECTION
|
||||||
SELECT fid, IsEmpty(g) FROM gis_geometry;
|
SELECT fid, IsEmpty(g) FROM gis_geometry;
|
||||||
fid IsEmpty(g)
|
fid IsEmpty(g)
|
||||||
101 0
|
101 0
|
||||||
@ -201,6 +211,8 @@ fid IsEmpty(g)
|
|||||||
119 0
|
119 0
|
||||||
120 0
|
120 0
|
||||||
121 0
|
121 0
|
||||||
|
122 0
|
||||||
|
123 0
|
||||||
SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
|
SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
|
||||||
fid AsText(Envelope(g))
|
fid AsText(Envelope(g))
|
||||||
101 POLYGON((10 10,10 10,10 10,10 10,10 10))
|
101 POLYGON((10 10,10 10,10 10,10 10,10 10))
|
||||||
@ -224,11 +236,13 @@ fid AsText(Envelope(g))
|
|||||||
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
|
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
|
||||||
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
|
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
|
||||||
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
|
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
|
||||||
|
122 GEOMETRYCOLLECTION EMPTY
|
||||||
|
123 GEOMETRYCOLLECTION EMPTY
|
||||||
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
|
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
|
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 23 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
|
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
|
||||||
SELECT fid, X(g) FROM gis_point;
|
SELECT fid, X(g) FROM gis_point;
|
||||||
fid X(g)
|
fid X(g)
|
||||||
101 10
|
101 10
|
||||||
@ -245,7 +259,7 @@ explain extended select X(g),Y(g) FROM gis_point;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
|
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
|
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
|
||||||
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
|
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
|
||||||
fid AsText(StartPoint(g))
|
fid AsText(StartPoint(g))
|
||||||
105 POINT(0 0)
|
105 POINT(0 0)
|
||||||
@ -280,7 +294,7 @@ explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),Num
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
|
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
|
||||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
|
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
|
||||||
fid AsText(Centroid(g))
|
fid AsText(Centroid(g))
|
||||||
108 POINT(15 15)
|
108 POINT(15 15)
|
||||||
@ -310,7 +324,7 @@ explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumI
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
|
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
|
||||||
SELECT fid, IsClosed(g) FROM gis_multi_line;
|
SELECT fid, IsClosed(g) FROM gis_multi_line;
|
||||||
fid IsClosed(g)
|
fid IsClosed(g)
|
||||||
114 0
|
114 0
|
||||||
@ -345,11 +359,13 @@ SELECT fid, NumGeometries(g) from gis_geometrycollection;
|
|||||||
fid NumGeometries(g)
|
fid NumGeometries(g)
|
||||||
120 2
|
120 2
|
||||||
121 2
|
121 2
|
||||||
|
122 0
|
||||||
|
123 0
|
||||||
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
|
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
|
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
|
||||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
||||||
fid AsText(GeometryN(g, 2))
|
fid AsText(GeometryN(g, 2))
|
||||||
111 POINT(10 10)
|
111 POINT(10 10)
|
||||||
@ -369,35 +385,51 @@ SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
|
|||||||
fid AsText(GeometryN(g, 2))
|
fid AsText(GeometryN(g, 2))
|
||||||
120 LINESTRING(0 0,10 10)
|
120 LINESTRING(0 0,10 10)
|
||||||
121 LINESTRING(3 6,7 9)
|
121 LINESTRING(3 6,7 9)
|
||||||
|
122 NULL
|
||||||
|
123 NULL
|
||||||
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
|
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
|
||||||
fid AsText(GeometryN(g, 1))
|
fid AsText(GeometryN(g, 1))
|
||||||
120 POINT(0 0)
|
120 POINT(0 0)
|
||||||
121 POINT(44 6)
|
121 POINT(44 6)
|
||||||
|
122 NULL
|
||||||
|
123 NULL
|
||||||
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
|
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
|
||||||
SELECT g1.fid as first, g2.fid as second,
|
SELECT g1.fid as first, g2.fid as second,
|
||||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 1 1 0
|
||||||
120 121 0 0 1 0 0 0 1 0
|
120 121 0 0 1 0 0 0 1 0
|
||||||
|
120 122 0 1 NULL 0 NULL 0 NULL 0
|
||||||
|
120 123 0 1 NULL 0 NULL 0 NULL 0
|
||||||
121 120 0 0 1 0 0 0 1 0
|
121 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 1 1 0
|
||||||
|
121 122 0 1 NULL 0 NULL 0 NULL 0
|
||||||
|
121 123 0 1 NULL 0 NULL 0 NULL 0
|
||||||
|
122 120 1 0 NULL 0 NULL 0 NULL 0
|
||||||
|
122 121 1 0 NULL 0 NULL 0 NULL 0
|
||||||
|
122 122 1 1 NULL 1 NULL 0 NULL 0
|
||||||
|
122 123 1 1 NULL 1 NULL 0 NULL 0
|
||||||
|
123 120 1 0 NULL 0 NULL 0 NULL 0
|
||||||
|
123 121 1 0 NULL 0 NULL 0 NULL 0
|
||||||
|
123 122 1 1 NULL 1 NULL 0 NULL 0
|
||||||
|
123 123 1 1 NULL 1 NULL 0 NULL 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
1 SIMPLE g1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||||
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
|
1 SIMPLE g2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join)
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
|
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
|
||||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
gp point,
|
gp point,
|
||||||
@ -439,12 +471,12 @@ explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
|
Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
|
||||||
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
|
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
|
Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
|
||||||
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
|
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
|
||||||
SRID(GeomFromText('LineString(1 1,2 2)',101))
|
SRID(GeomFromText('LineString(1 1,2 2)',101))
|
||||||
101
|
101
|
||||||
@ -452,12 +484,12 @@ explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select srid(geometryfromtext('LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
|
Note 1003 select srid(st_geometryfromtext('LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
|
||||||
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
|
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
|
Note 1003 select st_issimple(st_multipoint(st_point(3,6),st_point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(st_point(3,6)) AS `issimple(Point(3, 6))`
|
||||||
create table t1 (a geometry not null);
|
create table t1 (a geometry not null);
|
||||||
insert into t1 values (GeomFromText('Point(1 2)'));
|
insert into t1 values (GeomFromText('Point(1 2)'));
|
||||||
insert into t1 values ('Garbage');
|
insert into t1 values ('Garbage');
|
||||||
@ -651,11 +683,11 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
|
|||||||
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
|
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
|
||||||
t1 where object_id=85998;
|
t1 where object_id=85998;
|
||||||
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
|
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
|
||||||
85998 MULTIPOLYGON 0 POINT(115.31877315203187 -36.23747282102153)
|
85998 MULTIPOLYGON 1 POINT(115.31877315203187 -36.23747282102153)
|
||||||
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
|
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
|
||||||
t1 where object_id=85984;
|
t1 where object_id=85984;
|
||||||
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
|
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
|
||||||
85984 MULTIPOLYGON 0 POINT(-114.87787186923313 36.33101763469059)
|
85984 MULTIPOLYGON 1 POINT(-114.87787186923313 36.33101763469059)
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (fl geometry not null);
|
create table t1 (fl geometry not null);
|
||||||
insert into t1 values (1);
|
insert into t1 values (1);
|
||||||
@ -802,17 +834,6 @@ create table t1 (g geometry not null);
|
|||||||
insert into t1 values(default);
|
insert into t1 values(default);
|
||||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (a GEOMETRY);
|
|
||||||
CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
|
|
||||||
CREATE VIEW v2 AS SELECT a FROM t1;
|
|
||||||
DESCRIBE v1;
|
|
||||||
Field Type Null Key Default Extra
|
|
||||||
GeomFromwkb(ASBINARY(a)) geometry YES NULL
|
|
||||||
DESCRIBE v2;
|
|
||||||
Field Type Null Key Default Extra
|
|
||||||
a geometry YES NULL
|
|
||||||
DROP VIEW v1,v2;
|
|
||||||
DROP TABLE t1;
|
|
||||||
create table t1 (name VARCHAR(100), square GEOMETRY);
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
@ -846,7 +867,7 @@ mbroverlaps
|
|||||||
down,left,right,up
|
down,left,right,up
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
mbrtouches
|
mbrtouches
|
||||||
down2,left2,right2,up2
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
mbrwithin
|
mbrwithin
|
||||||
big,center
|
big,center
|
||||||
@ -867,7 +888,7 @@ overlaps
|
|||||||
down,left,right,up
|
down,left,right,up
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
touches
|
touches
|
||||||
down2,left2,right2,up2
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
within
|
within
|
||||||
big,center
|
big,center
|
||||||
@ -1043,10 +1064,6 @@ create spatial index i on t1 (a);
|
|||||||
ERROR 42000: A SPATIAL index may only contain a geometrical type column
|
ERROR 42000: A SPATIAL index may only contain a geometrical type column
|
||||||
drop table t1;
|
drop table t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
CREATE TABLE t0 (a BINARY(32) NOT NULL);
|
|
||||||
CREATE SPATIAL INDEX i on t0 (a);
|
|
||||||
ERROR 42000: A SPATIAL index may only contain a geometrical type column
|
|
||||||
INSERT INTO t0 VALUES (1);
|
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
col0 BINARY NOT NULL,
|
col0 BINARY NOT NULL,
|
||||||
col2 TIMESTAMP,
|
col2 TIMESTAMP,
|
||||||
@ -1075,7 +1092,373 @@ col2 LINESTRING,
|
|||||||
SPATIAL INDEX i1 (col1, col2)
|
SPATIAL INDEX i1 (col1, col2)
|
||||||
);
|
);
|
||||||
ERROR HY000: Incorrect arguments to SPATIAL INDEX
|
ERROR HY000: Incorrect arguments to SPATIAL INDEX
|
||||||
DROP TABLE t0, t1, t2;
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
|
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
|
||||||
|
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
|
||||||
|
1.5
|
||||||
|
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
|
||||||
|
ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'))
|
||||||
|
160
|
||||||
|
DROP DATABASE IF EXISTS gis_ogs;
|
||||||
|
CREATE DATABASE gis_ogs;
|
||||||
|
USE gis_ogs;
|
||||||
|
#
|
||||||
|
# C.3.3.1 Geometry types and functions schema construction
|
||||||
|
#
|
||||||
|
CREATE TABLE lakes (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
shore POLYGON);
|
||||||
|
CREATE TABLE road_segments (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
aliases CHARACTER VARYING(64),
|
||||||
|
num_lanes INTEGER,
|
||||||
|
centerline LINESTRING);
|
||||||
|
CREATE TABLE divided_routes (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
num_lanes INTEGER,
|
||||||
|
centerlines MULTILINESTRING);
|
||||||
|
CREATE TABLE forests (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
boundary MULTIPOLYGON);
|
||||||
|
CREATE TABLE bridges (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
position POINT);
|
||||||
|
CREATE TABLE streams (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
centerline LINESTRING);
|
||||||
|
CREATE TABLE buildings (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
address CHARACTER VARYING(64),
|
||||||
|
position POINT,
|
||||||
|
footprint POLYGON);
|
||||||
|
CREATE TABLE ponds (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
type CHARACTER VARYING(64),
|
||||||
|
shores MULTIPOLYGON);
|
||||||
|
CREATE TABLE named_places (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
boundary POLYGON);
|
||||||
|
CREATE TABLE map_neatlines (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
neatline POLYGON);
|
||||||
|
#
|
||||||
|
# C.3.3.2 Geometry types and functions schema data loading
|
||||||
|
#
|
||||||
|
# Lakes
|
||||||
|
INSERT INTO lakes VALUES (
|
||||||
|
101, 'BLUE LAKE',
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON(
|
||||||
|
(52 18,66 23,73 9,48 6,52 18),
|
||||||
|
(59 18,67 18,67 13,59 13,59 18)
|
||||||
|
)',
|
||||||
|
101));
|
||||||
|
# Road Segments
|
||||||
|
INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
|
||||||
|
INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
|
||||||
|
INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 70 38, 72 48 )' ,101));
|
||||||
|
INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 70 38, 84 42 )' ,101));
|
||||||
|
INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
|
||||||
|
1,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 28 26, 28 0 )',101));
|
||||||
|
# DividedRoutes
|
||||||
|
INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
|
||||||
|
MLineFromText(
|
||||||
|
'MULTILINESTRING((10 48,10 21,10 0),
|
||||||
|
(16 0,16 23,16 48))', 101));
|
||||||
|
# Forests
|
||||||
|
INSERT INTO forests VALUES(109, 'Green Forest',
|
||||||
|
MPolyFromText(
|
||||||
|
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
|
||||||
|
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
|
||||||
|
101));
|
||||||
|
# Bridges
|
||||||
|
INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
|
||||||
|
'POINT( 44 31 )', 101));
|
||||||
|
# Streams
|
||||||
|
INSERT INTO streams VALUES(111, 'Cam Stream',
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
|
||||||
|
INSERT INTO streams VALUES(112, NULL,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
|
||||||
|
# Buildings
|
||||||
|
INSERT INTO buildings VALUES(113, '123 Main Street',
|
||||||
|
PointFromText(
|
||||||
|
'POINT( 52 30 )', 101),
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
|
||||||
|
INSERT INTO buildings VALUES(114, '215 Main Street',
|
||||||
|
PointFromText(
|
||||||
|
'POINT( 64 33 )', 101),
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
|
||||||
|
# Ponds
|
||||||
|
INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
|
||||||
|
MPolyFromText(
|
||||||
|
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
|
||||||
|
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
|
||||||
|
# Named Places
|
||||||
|
INSERT INTO named_places VALUES(117, 'Ashton',
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
|
||||||
|
INSERT INTO named_places VALUES(118, 'Goose Island',
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
|
||||||
|
# Map Neatlines
|
||||||
|
INSERT INTO map_neatlines VALUES(115,
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
|
||||||
|
#
|
||||||
|
# C.3.3.3 Geometry types and functions schema test queries
|
||||||
|
|
||||||
|
# Conformance Item T6
|
||||||
|
SELECT Dimension(shore)
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
Dimension(shore)
|
||||||
|
2
|
||||||
|
# Conformance Item T7
|
||||||
|
SELECT GeometryType(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
GeometryType(centerlines)
|
||||||
|
MULTILINESTRING
|
||||||
|
# Conformance Item T8
|
||||||
|
SELECT AsText(boundary)
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
AsText(boundary)
|
||||||
|
POLYGON((67 13,67 18,59 18,59 13,67 13))
|
||||||
|
# Conformance Item T9
|
||||||
|
SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
AsText(PolyFromWKB(AsBinary(boundary),101))
|
||||||
|
POLYGON((67 13,67 18,59 18,59 13,67 13))
|
||||||
|
# Conformance Item T10
|
||||||
|
SELECT SRID(boundary)
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
SRID(boundary)
|
||||||
|
101
|
||||||
|
# Conformance Item T11
|
||||||
|
SELECT IsEmpty(centerline)
|
||||||
|
FROM road_segments
|
||||||
|
WHERE name = 'Route 5'
|
||||||
|
AND aliases = 'Main Street';
|
||||||
|
IsEmpty(centerline)
|
||||||
|
0
|
||||||
|
# Conformance Item T14
|
||||||
|
SELECT AsText(Envelope(boundary))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
AsText(Envelope(boundary))
|
||||||
|
POLYGON((59 13,67 13,67 18,59 18,59 13))
|
||||||
|
# Conformance Item T15
|
||||||
|
SELECT X(position)
|
||||||
|
FROM bridges
|
||||||
|
WHERE name = 'Cam Bridge';
|
||||||
|
X(position)
|
||||||
|
44
|
||||||
|
# Conformance Item T16
|
||||||
|
SELECT Y(position)
|
||||||
|
FROM bridges
|
||||||
|
WHERE name = 'Cam Bridge';
|
||||||
|
Y(position)
|
||||||
|
31
|
||||||
|
# Conformance Item T17
|
||||||
|
SELECT AsText(StartPoint(centerline))
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
AsText(StartPoint(centerline))
|
||||||
|
POINT(0 18)
|
||||||
|
# Conformance Item T18
|
||||||
|
SELECT AsText(EndPoint(centerline))
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
AsText(EndPoint(centerline))
|
||||||
|
POINT(44 31)
|
||||||
|
# Conformance Item T21
|
||||||
|
SELECT GLength(centerline)
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 106;
|
||||||
|
GLength(centerline)
|
||||||
|
26
|
||||||
|
# Conformance Item T22
|
||||||
|
SELECT NumPoints(centerline)
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
NumPoints(centerline)
|
||||||
|
5
|
||||||
|
# Conformance Item T23
|
||||||
|
SELECT AsText(PointN(centerline, 1))
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
AsText(PointN(centerline, 1))
|
||||||
|
POINT(0 18)
|
||||||
|
# Conformance Item T24
|
||||||
|
SELECT AsText(Centroid(boundary))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
AsText(Centroid(boundary))
|
||||||
|
POINT(63 15.5)
|
||||||
|
# Conformance Item T26
|
||||||
|
SELECT Area(boundary)
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
Area(boundary)
|
||||||
|
40
|
||||||
|
# Conformance Item T27
|
||||||
|
SELECT AsText(ExteriorRing(shore))
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
AsText(ExteriorRing(shore))
|
||||||
|
LINESTRING(52 18,66 23,73 9,48 6,52 18)
|
||||||
|
# Conformance Item T28
|
||||||
|
SELECT NumInteriorRings(shore)
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
NumInteriorRings(shore)
|
||||||
|
1
|
||||||
|
# Conformance Item T29
|
||||||
|
SELECT AsText(InteriorRingN(shore, 1))
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
AsText(InteriorRingN(shore, 1))
|
||||||
|
LINESTRING(59 18,67 18,67 13,59 13,59 18)
|
||||||
|
# Conformance Item T30
|
||||||
|
SELECT NumGeometries(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
NumGeometries(centerlines)
|
||||||
|
2
|
||||||
|
# Conformance Item T31
|
||||||
|
SELECT AsText(GeometryN(centerlines, 2))
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
AsText(GeometryN(centerlines, 2))
|
||||||
|
LINESTRING(16 0,16 23,16 48)
|
||||||
|
# Conformance Item T32
|
||||||
|
SELECT IsClosed(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
IsClosed(centerlines)
|
||||||
|
0
|
||||||
|
# Conformance Item T33
|
||||||
|
SELECT GLength(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
GLength(centerlines)
|
||||||
|
96
|
||||||
|
# Conformance Item T34
|
||||||
|
SELECT AsText(Centroid(shores))
|
||||||
|
FROM ponds
|
||||||
|
WHERE fid = 120;
|
||||||
|
AsText(Centroid(shores))
|
||||||
|
POINT(25 42)
|
||||||
|
# Conformance Item T36
|
||||||
|
SELECT Area(shores)
|
||||||
|
FROM ponds
|
||||||
|
WHERE fid = 120;
|
||||||
|
Area(shores)
|
||||||
|
8
|
||||||
|
# Conformance Item T37
|
||||||
|
SELECT ST_Equals(boundary,
|
||||||
|
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
ST_Equals(boundary,
|
||||||
|
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
|
||||||
|
1
|
||||||
|
# Conformance Item T38
|
||||||
|
SELECT ST_Disjoint(centerlines, boundary)
|
||||||
|
FROM divided_routes, named_places
|
||||||
|
WHERE divided_routes.name = 'Route 75'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
ST_Disjoint(centerlines, boundary)
|
||||||
|
1
|
||||||
|
# Conformance Item T39
|
||||||
|
SELECT ST_Touches(centerline, shore)
|
||||||
|
FROM streams, lakes
|
||||||
|
WHERE streams.name = 'Cam Stream'
|
||||||
|
AND lakes.name = 'Blue Lake';
|
||||||
|
ST_Touches(centerline, shore)
|
||||||
|
1
|
||||||
|
# Conformance Item T42
|
||||||
|
SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
|
||||||
|
FROM road_segments, divided_routes
|
||||||
|
WHERE road_segments.fid = 102
|
||||||
|
AND divided_routes.name = 'Route 75';
|
||||||
|
Crosses(road_segments.centerline, divided_routes.centerlines)
|
||||||
|
1
|
||||||
|
# Conformance Item T43
|
||||||
|
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
|
||||||
|
FROM road_segments, divided_routes
|
||||||
|
WHERE road_segments.fid = 102
|
||||||
|
AND divided_routes.name = 'Route 75';
|
||||||
|
ST_Intersects(road_segments.centerline, divided_routes.centerlines)
|
||||||
|
1
|
||||||
|
# Conformance Item T44
|
||||||
|
SELECT ST_Contains(forests.boundary, named_places.boundary)
|
||||||
|
FROM forests, named_places
|
||||||
|
WHERE forests.name = 'Green Forest'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
ST_Contains(forests.boundary, named_places.boundary)
|
||||||
|
0
|
||||||
|
# Conformance Item T46
|
||||||
|
SELECT ST_Distance(position, boundary)
|
||||||
|
FROM bridges, named_places
|
||||||
|
WHERE bridges.name = 'Cam Bridge'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
ST_Distance(position, boundary)
|
||||||
|
12
|
||||||
|
# Conformance Item T48
|
||||||
|
SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
|
||||||
|
FROM named_places, forests
|
||||||
|
WHERE named_places.name = 'Ashton'
|
||||||
|
AND forests.name = 'Green Forest';
|
||||||
|
AsText(ST_Difference(named_places.boundary, forests.boundary))
|
||||||
|
POLYGON((56 34,62 48,84 48,84 42,56 34))
|
||||||
|
SELECT AsText(ST_Union(shore, boundary))
|
||||||
|
FROM lakes, named_places
|
||||||
|
WHERE lakes.name = 'Blue Lake'
|
||||||
|
AND named_places.name = 'Goose Island';
|
||||||
|
AsText(ST_Union(shore, boundary))
|
||||||
|
POLYGON((48 6,52 18,66 23,73 9,48 6))
|
||||||
|
# Conformance Item T50
|
||||||
|
SELECT AsText(ST_SymDifference(shore, boundary))
|
||||||
|
FROM lakes, named_places
|
||||||
|
WHERE lakes.name = 'Blue Lake'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
AsText(ST_SymDifference(shore, boundary))
|
||||||
|
MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
|
||||||
|
# Conformance Item T51
|
||||||
|
SELECT count(*)
|
||||||
|
FROM buildings, bridges
|
||||||
|
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
|
||||||
|
count(*)
|
||||||
|
1
|
||||||
|
DROP DATABASE gis_ogs;
|
||||||
|
USE test;
|
||||||
#
|
#
|
||||||
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
|
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
|
||||||
#
|
#
|
||||||
|
@ -1544,7 +1544,8 @@ EXPLAIN SELECT 1 FROM t1 WHERE a IN
|
|||||||
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index
|
1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 144 Using where; FirstMatch(t1)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 144
|
||||||
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
||||||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
||||||
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
||||||
@ -1894,8 +1895,8 @@ SELECT a, AVG(t1.b),
|
|||||||
FROM t1 GROUP BY a;
|
FROM t1 GROUP BY a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 index NULL a 10 NULL 9 Using index
|
1 PRIMARY t1 index NULL a 10 NULL 9 Using index
|
||||||
3 DEPENDENT SUBQUERY t12 ref a a 10 func,func 2 Using where
|
3 DEPENDENT SUBQUERY t12 ref a a 10 func,func 2 Using index condition
|
||||||
2 DEPENDENT SUBQUERY t11 ref a a 10 func,func 2 Using where
|
2 DEPENDENT SUBQUERY t11 ref a a 10 func,func 2 Using index condition
|
||||||
SELECT a, AVG(t1.b),
|
SELECT a, AVG(t1.b),
|
||||||
(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
|
(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
|
||||||
(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
|
(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
|
||||||
|
@ -2401,8 +2401,9 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||||
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using where; Using index
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index NULL a 10 NULL 1 Using index
|
1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 Using index
|
||||||
|
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
|
||||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
|
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
|
||||||
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
@ -74,12 +74,12 @@ EXPLAIN
|
|||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Name LIKE 'M%' AND Population > 300000;
|
WHERE Name LIKE 'M%' AND Population > 300000;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Name Name 35 NULL # Using where
|
1 SIMPLE City range Population,Name Name 35 NULL # Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Name LIKE 'M%' AND Population > 7000000;
|
WHERE Name LIKE 'M%' AND Population > 7000000;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Name Population 4 NULL # Using where
|
1 SIMPLE City range Population,Name Population 4 NULL # Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE Name LIKE 'C%' AND Population > 1000000;
|
WHERE Name LIKE 'C%' AND Population > 1000000;
|
||||||
ID Name Country Population
|
ID Name Country Population
|
||||||
@ -371,7 +371,7 @@ EXPLAIN
|
|||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
|
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Name,Country Name # NULL # Using where
|
1 SIMPLE City range Population,Name,Country Name # NULL # Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
|
WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
|
||||||
ID Name Country Population
|
ID Name Country Population
|
||||||
@ -462,7 +462,7 @@ EXPLAIN
|
|||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
|
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using where
|
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
|
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
|
||||||
@ -472,7 +472,7 @@ EXPLAIN
|
|||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%';
|
WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country Country 3 NULL # Using where
|
1 SIMPLE City range PRIMARY,Population,Country Country 3 NULL # Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000
|
WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000
|
||||||
@ -484,7 +484,7 @@ SELECT * FROM City
|
|||||||
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
|
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
|
||||||
AND Country BETWEEN 'S' AND 'Z' ;
|
AND Country BETWEEN 'S' AND 'Z' ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using where
|
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
|
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
|
||||||
ID Name Country Population
|
ID Name Country Population
|
||||||
@ -733,7 +733,7 @@ EXPLAIN
|
|||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
|
WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Country,Name Name 35 NULL # Using where
|
1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
|
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
|
||||||
@ -744,7 +744,7 @@ SELECT * FROM City
|
|||||||
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
|
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
|
||||||
AND Country BETWEEN 'S' AND 'Z';
|
AND Country BETWEEN 'S' AND 'Z';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using where
|
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where
|
||||||
SELECT * FROM City WHERE
|
SELECT * FROM City WHERE
|
||||||
Name LIKE 'C%' AND Population > 1000000;
|
Name LIKE 'C%' AND Population > 1000000;
|
||||||
ID Name Country Population
|
ID Name Country Population
|
||||||
@ -1035,7 +1035,7 @@ EXPLAIN
|
|||||||
SELECT * FROM t1
|
SELECT * FROM t1
|
||||||
WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
|
WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL # Using where
|
1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL # Using index condition; Using where
|
||||||
SELECT * FROM t1
|
SELECT * FROM t1
|
||||||
WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
|
WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
|
||||||
f1 f4 f5
|
f1 f4 f5
|
||||||
|
@ -549,7 +549,7 @@ primary key (pk1, pk2)
|
|||||||
);
|
);
|
||||||
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where
|
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using index condition; Using where
|
||||||
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||||
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
|
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
|
||||||
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
|
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
|
||||||
|
@ -21,7 +21,7 @@ Table Op Msg_type Msg_text
|
|||||||
test.t0 analyze status OK
|
test.t0 analyze status OK
|
||||||
explain select * from t0 where key1 < 3 or key1 > 1020;
|
explain select * from t0 where key1 < 3 or key1 > 1020;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t0 range i1 i1 4 NULL 78 Using where
|
1 SIMPLE t0 range i1 i1 4 NULL 78 Using index condition; Using where
|
||||||
explain
|
explain
|
||||||
select * from t0 where key1 < 3 or key2 > 1020;
|
select * from t0 where key1 < 3 or key2 > 1020;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
@ -277,7 +277,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
explain select * from t0,t1 where t0.key1 < 3 and
|
explain select * from t0,t1 where t0.key1 < 3 and
|
||||||
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
|
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t0 range i1 i1 4 NULL 3 Using where
|
1 SIMPLE t0 range i1 i1 4 NULL 3 Using index condition
|
||||||
1 SIMPLE t1 ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81)
|
1 SIMPLE t1 ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81)
|
||||||
explain select * from t1 where key1=3 or key2=4
|
explain select * from t1 where key1=3 or key2=4
|
||||||
union select * from t1 where key1<4 or key3=5;
|
union select * from t1 where key1<4 or key3=5;
|
||||||
@ -1379,7 +1379,7 @@ primary key (pk1, pk2)
|
|||||||
);
|
);
|
||||||
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 7 Using where
|
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 7 Using index condition; Using where
|
||||||
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||||
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
|
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
|
||||||
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
|
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
|
||||||
|
@ -1266,7 +1266,7 @@ Variable_name Value
|
|||||||
Handler_read_first 0
|
Handler_read_first 0
|
||||||
Handler_read_key 1
|
Handler_read_key 1
|
||||||
Handler_read_last 0
|
Handler_read_last 0
|
||||||
Handler_read_next 2
|
Handler_read_next 0
|
||||||
Handler_read_prev 0
|
Handler_read_prev 0
|
||||||
Handler_read_rnd 0
|
Handler_read_rnd 0
|
||||||
Handler_read_rnd_next 1
|
Handler_read_rnd_next 1
|
||||||
|
@ -1457,12 +1457,12 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL X
|
1 SIMPLE t2 ALL NULL NULL NULL NULL X
|
||||||
1 SIMPLE t3 ref a a 5 test.t2.b X Using where
|
1 SIMPLE t3 ref a a 5 test.t2.b X Using where
|
||||||
1 SIMPLE t5 ref a a 5 test.t3.b X
|
1 SIMPLE t5 ref a a 5 test.t3.b X
|
||||||
1 SIMPLE t4 ref a a 5 test.t3.b X Using where
|
1 SIMPLE t4 ref a a 5 test.t3.b X Using index condition
|
||||||
explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b
|
explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b
|
||||||
join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b;
|
join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL X
|
1 SIMPLE t2 ALL NULL NULL NULL NULL X
|
||||||
1 SIMPLE t3 ref a a 5 test.t2.b X Using where
|
1 SIMPLE t3 ref a a 5 test.t2.b X Using index condition
|
||||||
1 SIMPLE t4 ref a a 5 test.t3.b X Using where
|
1 SIMPLE t4 ref a a 5 test.t3.b X Using where
|
||||||
1 SIMPLE t6 ref a a 5 test.t4.b X
|
1 SIMPLE t6 ref a a 5 test.t4.b X
|
||||||
1 SIMPLE t5 ref a a 5 test.t2.b X Using where
|
1 SIMPLE t5 ref a a 5 test.t2.b X Using where
|
||||||
|
@ -33,5 +33,5 @@ SELECT STRAIGHT_JOIN g.id FROM t2 a, t3 g USE INDEX(groups_dt)
|
|||||||
WHERE g.domain = 'queue' AND g.type = a.type;
|
WHERE g.domain = 'queue' AND g.type = a.type;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE a ALL NULL NULL NULL NULL 2 Using where
|
1 SIMPLE a ALL NULL NULL NULL NULL 2 Using where
|
||||||
1 SIMPLE g ref groups_dt groups_dt 70 const,test.a.type 13 Using where
|
1 SIMPLE g ref groups_dt groups_dt 70 const,test.a.type 13 Using index condition
|
||||||
drop table t0,t1,t2,t3;
|
drop table t0,t1,t2,t3;
|
||||||
|
@ -646,7 +646,7 @@ select p from t1 where p between 1010 and 1020;
|
|||||||
p
|
p
|
||||||
explain select i from t2 where p between 1010 and 1020;
|
explain select i from t2 where p between 1010 and 1020;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 28 Using where
|
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 28 Using index condition
|
||||||
select i from t2 where p between 1010 and 1020;
|
select i from t2 where p between 1010 and 1020;
|
||||||
i
|
i
|
||||||
1
|
1
|
||||||
|
@ -677,7 +677,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
|
EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
|
||||||
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
|
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,files PRIMARY 35 NULL 5 Using where
|
1 SIMPLE t1 range PRIMARY,files PRIMARY 35 NULL 5 Using index condition
|
||||||
EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
|
EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
|
||||||
AND file_code = '0000000115' LIMIT 1;
|
AND file_code = '0000000115' LIMIT 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
@ -1114,11 +1114,11 @@ count(*)
|
|||||||
29267
|
29267
|
||||||
explain select * from t1 where c between 1 and 2500;
|
explain select * from t1 where c between 1 and 2500;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c c 5 NULL # Using where
|
1 SIMPLE t1 range c c 5 NULL # Using index condition
|
||||||
update t1 set c=a;
|
update t1 set c=a;
|
||||||
explain select * from t1 where c between 1 and 2500;
|
explain select * from t1 where c between 1 and 2500;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range c c 5 NULL # Using where
|
1 SIMPLE t1 range c c 5 NULL # Using index condition
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=MyISAM;
|
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=MyISAM;
|
||||||
insert into t1 (id) values (null),(null),(null),(null),(null);
|
insert into t1 (id) values (null),(null),(null),(null),(null);
|
||||||
|
@ -392,7 +392,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
|
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
|
||||||
explain select * from t1 force index (a) where a=0 or a=2;
|
explain select * from t1 force index (a) where a=0 or a=2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 4 NULL 4 Using where
|
1 SIMPLE t1 range a a 4 NULL 4 Using index condition; Using where
|
||||||
explain select * from t1 where c=1;
|
explain select * from t1 where c=1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref c,c_2 c 5 const 1
|
1 SIMPLE t1 ref c,c_2 c 5 const 1
|
||||||
|
@ -763,8 +763,8 @@ t2.b NOT IN (SELECT t4.b FROM t3 STRAIGHT_JOIN t4 WHERE t4.b <= 2 AND t4.c = t3.
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||||
2 DEPENDENT SUBQUERY t4 ref_or_null b b 5 func 2 Using where; Full scan on NULL key
|
2 SUBQUERY t4 range b b 5 NULL 1 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join)
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.c=t2.b
|
SELECT * FROM t1 LEFT JOIN t2 ON t1.c=t2.b
|
||||||
WHERE
|
WHERE
|
||||||
t2.b NOT IN (SELECT t4.b FROM t3 STRAIGHT_JOIN t4 WHERE t4.b <= 2 AND t4.c = t3.c);
|
t2.b NOT IN (SELECT t4.b FROM t3 STRAIGHT_JOIN t4 WHERE t4.b <= 2 AND t4.c = t3.c);
|
||||||
|
@ -1000,7 +1000,7 @@ old-passwords FALSE
|
|||||||
old-style-user-limits FALSE
|
old-style-user-limits FALSE
|
||||||
optimizer-prune-level 1
|
optimizer-prune-level 1
|
||||||
optimizer-search-depth 62
|
optimizer-search-depth 62
|
||||||
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
performance-schema FALSE
|
performance-schema FALSE
|
||||||
performance-schema-events-waits-history-long-size 10000
|
performance-schema-events-waits-history-long-size 10000
|
||||||
performance-schema-events-waits-history-size 10
|
performance-schema-events-waits-history-size 10
|
||||||
|
@ -32,11 +32,18 @@ The following options may be given as the first argument:
|
|||||||
--big-tables Allow big result sets by saving all temporary sets on
|
--big-tables Allow big result sets by saving all temporary sets on
|
||||||
file (Solves most 'table full' errors)
|
file (Solves most 'table full' errors)
|
||||||
--bind-address=name IP address to bind to.
|
--bind-address=name IP address to bind to.
|
||||||
|
--binlog-annotate-row-events
|
||||||
|
Tells the master to annotate RBR events with the
|
||||||
|
statement that caused these events
|
||||||
--binlog-cache-size=#
|
--binlog-cache-size=#
|
||||||
The size of the transactional cache for updates to
|
The size of the transactional cache for updates to
|
||||||
transactional engines for the binary log. If you often
|
transactional engines for the binary log. If you often
|
||||||
use transactions containing many statements, you can
|
use transactions containing many statements, you can
|
||||||
increase this to get more performance
|
increase this to get more performance
|
||||||
|
--binlog-checksum=name
|
||||||
|
Type of BINLOG_CHECKSUM_ALG. Include checksum for log
|
||||||
|
events in the binary log. Possible values are NONE and
|
||||||
|
CRC32; default is NONE.
|
||||||
--binlog-direct-non-transactional-updates
|
--binlog-direct-non-transactional-updates
|
||||||
Causes updates to non-transactional engines using
|
Causes updates to non-transactional engines using
|
||||||
statement format to be written directly to binary log.
|
statement format to be written directly to binary log.
|
||||||
@ -63,6 +70,15 @@ The following options may be given as the first argument:
|
|||||||
--binlog-ignore-db=name
|
--binlog-ignore-db=name
|
||||||
Tells the master that updates to the given database
|
Tells the master that updates to the given database
|
||||||
should not be logged to the binary log.
|
should not be logged to the binary log.
|
||||||
|
--binlog-optimize-thread-scheduling
|
||||||
|
Run fast part of group commit in a single thread, to
|
||||||
|
optimize kernel thread scheduling. On by default. Disable
|
||||||
|
to run each transaction in group commit in its own
|
||||||
|
thread, which can be slower at very high concurrency.
|
||||||
|
This option is mostly for testing one algorithm versus
|
||||||
|
the other, and it should not normally be necessary to
|
||||||
|
change it.
|
||||||
|
(Defaults to on; use --skip-binlog-optimize-thread-scheduling to disable.)
|
||||||
--binlog-row-event-max-size=#
|
--binlog-row-event-max-size=#
|
||||||
The maximum size of a row-based binary log event in
|
The maximum size of a row-based binary log event in
|
||||||
bytes. Rows will be grouped into events smaller than this
|
bytes. Rows will be grouped into events smaller than this
|
||||||
@ -104,6 +120,16 @@ The following options may be given as the first argument:
|
|||||||
--date-format=name The DATE format (ignored)
|
--date-format=name The DATE format (ignored)
|
||||||
--datetime-format=name
|
--datetime-format=name
|
||||||
The DATETIME format (ignored)
|
The DATETIME format (ignored)
|
||||||
|
--deadlock-search-depth-long=#
|
||||||
|
Long search depth for the two-step deadlock detection
|
||||||
|
--deadlock-search-depth-short=#
|
||||||
|
Short search depth for the two-step deadlock detection
|
||||||
|
--deadlock-timeout-long=#
|
||||||
|
Long timeout for the two-step deadlock detection (in
|
||||||
|
microseconds)
|
||||||
|
--deadlock-timeout-short=#
|
||||||
|
Short timeout for the two-step deadlock detection (in
|
||||||
|
microseconds)
|
||||||
--default-storage-engine=name
|
--default-storage-engine=name
|
||||||
The default storage engine for new tables
|
The default storage engine for new tables
|
||||||
--default-time-zone=name
|
--default-time-zone=name
|
||||||
@ -148,6 +174,11 @@ The following options may be given as the first argument:
|
|||||||
With this option enabled you can run myisamchk to test
|
With this option enabled you can run myisamchk to test
|
||||||
(not repair) tables while the MySQL server is running.
|
(not repair) tables while the MySQL server is running.
|
||||||
Disable with --skip-external-locking.
|
Disable with --skip-external-locking.
|
||||||
|
--extra-max-connections=#
|
||||||
|
The number of connections on extra-port
|
||||||
|
--extra-port=# Extra port number to use for tcp connections in a
|
||||||
|
one-thread-per-connection manner. 0 means don't use
|
||||||
|
another port
|
||||||
--flush Flush MyISAM tables to disk between SQL commands
|
--flush Flush MyISAM tables to disk between SQL commands
|
||||||
--flush-time=# A dedicated thread is created to flush all tables at the
|
--flush-time=# A dedicated thread is created to flush all tables at the
|
||||||
given interval
|
given interval
|
||||||
@ -177,6 +208,7 @@ The following options may be given as the first argument:
|
|||||||
--ignore-builtin-innodb
|
--ignore-builtin-innodb
|
||||||
Disable initialization of builtin InnoDB plugin
|
Disable initialization of builtin InnoDB plugin
|
||||||
--init-connect=name Command(s) that are executed for each new connection
|
--init-connect=name Command(s) that are executed for each new connection
|
||||||
|
(unless the user has SUPER privilege)
|
||||||
--init-file=name Read SQL commands from this file at startup
|
--init-file=name Read SQL commands from this file at startup
|
||||||
--init-rpl-role=name
|
--init-rpl-role=name
|
||||||
Set the replication role.
|
Set the replication role.
|
||||||
@ -186,7 +218,14 @@ The following options may be given as the first argument:
|
|||||||
The number of seconds the server waits for activity on an
|
The number of seconds the server waits for activity on an
|
||||||
interactive connection before closing it
|
interactive connection before closing it
|
||||||
--join-buffer-size=#
|
--join-buffer-size=#
|
||||||
The size of the buffer that is used for full joins
|
The size of the buffer that is used for joins
|
||||||
|
--join-buffer-space-limit=#
|
||||||
|
The limit of the space for all join buffers used by a
|
||||||
|
query
|
||||||
|
--join-cache-level=#
|
||||||
|
Controls what join operations can be executed with join
|
||||||
|
buffers. Odd numbers are used for plain join buffers
|
||||||
|
while even numbers are used for linked buffers
|
||||||
--keep-files-on-create
|
--keep-files-on-create
|
||||||
Don't overwrite stale .MYD and .MYI even if no directory
|
Don't overwrite stale .MYD and .MYI even if no directory
|
||||||
is specified
|
is specified
|
||||||
@ -204,6 +243,8 @@ The following options may be given as the first argument:
|
|||||||
The default size of key cache blocks
|
The default size of key cache blocks
|
||||||
--key-cache-division-limit=#
|
--key-cache-division-limit=#
|
||||||
The minimum percentage of warm blocks in key cache
|
The minimum percentage of warm blocks in key cache
|
||||||
|
--key-cache-segments=#
|
||||||
|
The number of segments in a key cache
|
||||||
-L, --language=name Client error messages in given language. May be given as
|
-L, --language=name Client error messages in given language. May be given as
|
||||||
a full path. Deprecated. Use --lc-messages-dir instead.
|
a full path. Deprecated. Use --lc-messages-dir instead.
|
||||||
--lc-messages=name Set the language used for the error messages.
|
--lc-messages=name Set the language used for the error messages.
|
||||||
@ -219,10 +260,20 @@ The following options may be given as the first argument:
|
|||||||
error.
|
error.
|
||||||
-l, --log[=name] Log connections and queries to file (deprecated option,
|
-l, --log[=name] Log connections and queries to file (deprecated option,
|
||||||
use --general-log/--general-log-file instead).
|
use --general-log/--general-log-file instead).
|
||||||
--log-bin[=name] Log update queries in binary format. Optional (but
|
--log-basename=name Basename for all log files and the .pid file. This sets
|
||||||
strongly recommended to avoid replication problems if
|
all log file names at once (in 'datadir') and is normally
|
||||||
server's hostname changes) argument should be the chosen
|
the only option you need for specifying log files. Sets
|
||||||
location for the binary log files.
|
names for --log-bin, --log-bin-index, --relay-log,
|
||||||
|
--relay-log-index, --general-log-file,
|
||||||
|
--log-slow-query-log-file, --log-error-file, and
|
||||||
|
--pid-file
|
||||||
|
--log-bin[=name] Log update queries in binary format. Optional argument
|
||||||
|
should be name for binary log. If not given
|
||||||
|
datadir/'log-basename'-bin or 'datadir'/mysql-bin will be
|
||||||
|
used (the later if --log-basename is not specified). We
|
||||||
|
strongly recommend to use either --log-basename or
|
||||||
|
specify a filename to ensure that replication doesn't
|
||||||
|
stop if the real hostname of the computer changes'.
|
||||||
--log-bin-index=name
|
--log-bin-index=name
|
||||||
File that holds the names for last binary log files.
|
File that holds the names for last binary log files.
|
||||||
--log-bin-trust-function-creators
|
--log-bin-trust-function-creators
|
||||||
@ -234,7 +285,9 @@ The following options may be given as the first argument:
|
|||||||
ALWAYS use row-based binary logging, the security issues
|
ALWAYS use row-based binary logging, the security issues
|
||||||
do not exist and the binary logging cannot break, so you
|
do not exist and the binary logging cannot break, so you
|
||||||
can safely set this to TRUE
|
can safely set this to TRUE
|
||||||
--log-error[=name] Error log file
|
--log-error[=name] Log errors to file (instead of stdout). If file name is
|
||||||
|
not specified then 'datadir'/'log-basename'.err or the
|
||||||
|
pid-file path with extension .err is used
|
||||||
--log-isam[=name] Log all MyISAM changes to file.
|
--log-isam[=name] Log all MyISAM changes to file.
|
||||||
--log-output=name Syntax: log-output=value[,value...], where "value" could
|
--log-output=name Syntax: log-output=value[,value...], where "value" could
|
||||||
be TABLE, FILE or NONE
|
be TABLE, FILE or NONE
|
||||||
@ -249,21 +302,38 @@ The following options may be given as the first argument:
|
|||||||
--log-slow-admin-statements
|
--log-slow-admin-statements
|
||||||
Log slow OPTIMIZE, ANALYZE, ALTER and other
|
Log slow OPTIMIZE, ANALYZE, ALTER and other
|
||||||
administrative statements to the slow log if it is open.
|
administrative statements to the slow log if it is open.
|
||||||
|
--log-slow-filter=name
|
||||||
|
Log only certain types of queries. Multiple flags can be
|
||||||
|
specified, separated by commas. Valid values are admin,
|
||||||
|
slave, filesort, filesort_on_disk, full_join, full_scan,
|
||||||
|
query_cache, query_cache_miss, tmp_table,
|
||||||
|
tmp_table_on_disk
|
||||||
--log-slow-queries[=name]
|
--log-slow-queries[=name]
|
||||||
Log slow queries to a table or log file. Defaults logging
|
Enable logging of slow queries (longer than
|
||||||
to table mysql.slow_log or hostname-slow.log if
|
--long-query-time) to log file or table. Optional
|
||||||
--log-output=file is used. Must be enabled to activate
|
argument is a file name for the slow log. If not given,
|
||||||
other slow log options. Deprecated option, use
|
'log-basename'-slow.log will be used. Use
|
||||||
|
--log-output=TABLE if you want to have the log in the
|
||||||
|
table 'mysql.slow_log'. Deprecated option, use
|
||||||
--slow-query-log/--slow-query-log-file instead.
|
--slow-query-log/--slow-query-log-file instead.
|
||||||
|
--log-slow-rate-limit=#
|
||||||
|
Write to slow log every #th slow query. Set to 1 to log
|
||||||
|
everything. Increase it to reduce the size of the slow or
|
||||||
|
the performance impact of slow logging
|
||||||
--log-slow-slave-statements
|
--log-slow-slave-statements
|
||||||
Log slow statements executed by slave thread to the slow
|
Log slow statements executed by slave thread to the slow
|
||||||
log if it is open.
|
log if it is open.
|
||||||
|
--log-slow-verbosity=name
|
||||||
|
log-slow-verbosity=[value[,value ...]] where value is one
|
||||||
|
of 'innodb', 'query_plan'
|
||||||
--log-tc=name Path to transaction coordinator log (used for
|
--log-tc=name Path to transaction coordinator log (used for
|
||||||
transactions that affect more than one storage engine,
|
transactions that affect more than one storage engine,
|
||||||
when binary log is disabled).
|
when binary log is disabled).
|
||||||
--log-tc-size=# Size of transaction coordinator log.
|
--log-tc-size=# Size of transaction coordinator log.
|
||||||
-W, --log-warnings[=#]
|
-W, --log-warnings[=#]
|
||||||
Log some not critical warnings to the log file
|
Log some not critical warnings to the general log
|
||||||
|
file.Value can be between 0 and 11. Higher values mean
|
||||||
|
more verbosity
|
||||||
--long-query-time=# Log all queries that have taken more than long_query_time
|
--long-query-time=# Log all queries that have taken more than long_query_time
|
||||||
seconds to execute to file. The argument will be treated
|
seconds to execute to file. The argument will be treated
|
||||||
as a decimal value with microsecond precision
|
as a decimal value with microsecond precision
|
||||||
@ -276,10 +346,14 @@ The following options may be given as the first argument:
|
|||||||
--master-info-file=name
|
--master-info-file=name
|
||||||
The location and name of the file that remembers the
|
The location and name of the file that remembers the
|
||||||
master and where the I/O replication thread is in the
|
master and where the I/O replication thread is in the
|
||||||
master's binlogs.
|
master's binlogs. Defaults to master.info
|
||||||
--master-retry-count=#
|
--master-retry-count=#
|
||||||
The number of tries the slave will make to connect to the
|
The number of tries the slave will make to connect to the
|
||||||
master before giving up.
|
master before giving up.
|
||||||
|
--master-verify-checksum
|
||||||
|
Force checksum verification of logged events in the
|
||||||
|
binary log before sending them to slaves or printing them
|
||||||
|
in the output of SHOW BINLOG EVENTS
|
||||||
--max-allowed-packet=#
|
--max-allowed-packet=#
|
||||||
Max packet length to send to or receive from the server
|
Max packet length to send to or receive from the server
|
||||||
--max-binlog-cache-size=#
|
--max-binlog-cache-size=#
|
||||||
@ -338,8 +412,9 @@ The following options may be given as the first argument:
|
|||||||
--min-examined-row-limit=#
|
--min-examined-row-limit=#
|
||||||
Don't write queries to slow log that examine fewer rows
|
Don't write queries to slow log that examine fewer rows
|
||||||
than that
|
than that
|
||||||
|
--mrr-buffer-size=# Size of buffer to use when using MRR with range access
|
||||||
--multi-range-count=#
|
--multi-range-count=#
|
||||||
Number of key ranges to request at once
|
Ignored. Use mrr_buffer_size instead
|
||||||
--myisam-block-size=#
|
--myisam-block-size=#
|
||||||
Block size to be used for MyISAM index pages
|
Block size to be used for MyISAM index pages
|
||||||
--myisam-data-pointer-size=#
|
--myisam-data-pointer-size=#
|
||||||
@ -352,7 +427,8 @@ The following options may be given as the first argument:
|
|||||||
MySQL tables
|
MySQL tables
|
||||||
--myisam-recover-options[=name]
|
--myisam-recover-options[=name]
|
||||||
Syntax: myisam-recover-options[=option[,option...]],
|
Syntax: myisam-recover-options[=option[,option...]],
|
||||||
where option can be DEFAULT, BACKUP, FORCE, QUICK, or OFF
|
where option can be DEFAULT, BACKUP, BACKUP_ALL, FORCE,
|
||||||
|
QUICK, or OFF
|
||||||
--myisam-repair-threads=#
|
--myisam-repair-threads=#
|
||||||
If larger than 1, when repairing a MyISAM table all
|
If larger than 1, when repairing a MyISAM table all
|
||||||
indexes will be created in parallel, with one thread per
|
indexes will be created in parallel, with one thread per
|
||||||
@ -378,7 +454,6 @@ The following options may be given as the first argument:
|
|||||||
--net-write-timeout=#
|
--net-write-timeout=#
|
||||||
Number of seconds to wait for a block to be written to a
|
Number of seconds to wait for a block to be written to a
|
||||||
connection before aborting the write
|
connection before aborting the write
|
||||||
-n, --new Use very new possible "unsafe" functions
|
|
||||||
--old Use compatible behavior
|
--old Use compatible behavior
|
||||||
--old-alter-table Use old, non-optimized alter table
|
--old-alter-table Use old, non-optimized alter table
|
||||||
--old-passwords Use old password encryption method (needed for 4.0 and
|
--old-passwords Use old password encryption method (needed for 4.0 and
|
||||||
@ -414,10 +489,18 @@ The following options may be given as the first argument:
|
|||||||
deprecated
|
deprecated
|
||||||
--optimizer-switch=name
|
--optimizer-switch=name
|
||||||
optimizer_switch=option=val[,option=val...], where option
|
optimizer_switch=option=val[,option=val...], where option
|
||||||
is one of {index_merge, index_merge_union,
|
is one of {derived_merge, derived_with_keys, firstmatch,
|
||||||
index_merge_sort_union, index_merge_intersection,
|
in_to_exists, engine_condition_pushdown,
|
||||||
engine_condition_pushdown} and val is one of {on, off,
|
index_condition_pushdown, index_merge,
|
||||||
default}
|
index_merge_intersection, index_merge_sort_intersection,
|
||||||
|
index_merge_sort_union, index_merge_union,
|
||||||
|
join_cache_bka, join_cache_hashed,
|
||||||
|
join_cache_incremental, loosescan, materialization, mrr,
|
||||||
|
mrr_cost_based, mrr_sort_keys, optimize_join_buffer_size,
|
||||||
|
outer_join_with_cache, partial_match_rowid_merge,
|
||||||
|
partial_match_table_scan, semijoin, semijoin_with_cache,
|
||||||
|
subquery_cache, table_elimination } and val is one of
|
||||||
|
{on, off, default}
|
||||||
--performance-schema
|
--performance-schema
|
||||||
Enable the performance schema.
|
Enable the performance schema.
|
||||||
--performance-schema-events-waits-history-long-size=#
|
--performance-schema-events-waits-history-long-size=#
|
||||||
@ -456,6 +539,10 @@ The following options may be given as the first argument:
|
|||||||
where each plugin is identified as name=library, where
|
where each plugin is identified as name=library, where
|
||||||
name is the plugin name and library is the plugin library
|
name is the plugin name and library is the plugin library
|
||||||
in plugin_dir.
|
in plugin_dir.
|
||||||
|
--plugin-maturity=name
|
||||||
|
The lowest desirable plugin maturity (unknown,
|
||||||
|
experimental, alpha, beta, gamma, or stable). Plugins
|
||||||
|
less mature than that will not be installed or loaded.
|
||||||
-P, --port=# Port number to use for connection or 0 to default to,
|
-P, --port=# Port number to use for connection or 0 to default to,
|
||||||
my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default
|
my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default
|
||||||
(3306), whatever comes first
|
(3306), whatever comes first
|
||||||
@ -467,6 +554,10 @@ The following options may be given as the first argument:
|
|||||||
indexes
|
indexes
|
||||||
--profiling-history-size=#
|
--profiling-history-size=#
|
||||||
Limit of query profiling memory
|
Limit of query profiling memory
|
||||||
|
--progress-report-time=#
|
||||||
|
Seconds between sending progress reports to the client
|
||||||
|
for time-consuming statements. Set to 0 to disable
|
||||||
|
progress reporting.
|
||||||
--query-alloc-block-size=#
|
--query-alloc-block-size=#
|
||||||
Allocation block size for query parsing and execution
|
Allocation block size for query parsing and execution
|
||||||
--query-cache-limit=#
|
--query-cache-limit=#
|
||||||
@ -475,6 +566,9 @@ The following options may be given as the first argument:
|
|||||||
The minimum size for blocks allocated by the query cache
|
The minimum size for blocks allocated by the query cache
|
||||||
--query-cache-size=#
|
--query-cache-size=#
|
||||||
The memory allocated to store results from old queries
|
The memory allocated to store results from old queries
|
||||||
|
--query-cache-strip-comments
|
||||||
|
Strip all comments from a query before storing it in the
|
||||||
|
query cache
|
||||||
--query-cache-type=name
|
--query-cache-type=name
|
||||||
OFF = Don't cache or retrieve results. ON = Cache all
|
OFF = Don't cache or retrieve results. ON = Cache all
|
||||||
results except SELECT SQL_NO_CACHE ... queries. DEMAND =
|
results except SELECT SQL_NO_CACHE ... queries. DEMAND =
|
||||||
@ -514,6 +608,10 @@ The following options may be given as the first argument:
|
|||||||
transaction processed
|
transaction processed
|
||||||
--relay-log-space-limit=#
|
--relay-log-space-limit=#
|
||||||
Maximum space to use for all relay logs
|
Maximum space to use for all relay logs
|
||||||
|
--replicate-annotate-row-events
|
||||||
|
Tells the slave to write annotate rows events recieved
|
||||||
|
from the master to its own binary log. Ignored if
|
||||||
|
log_slave_updates is not set
|
||||||
--replicate-do-db=name
|
--replicate-do-db=name
|
||||||
Tells the slave thread to restrict replication to the
|
Tells the slave thread to restrict replication to the
|
||||||
specified database. To specify more than one database,
|
specified database. To specify more than one database,
|
||||||
@ -590,6 +688,9 @@ The following options may be given as the first argument:
|
|||||||
not sure, leave this option unset
|
not sure, leave this option unset
|
||||||
--report-user=name The account user name of the slave to be reported to the
|
--report-user=name The account user name of the slave to be reported to the
|
||||||
master during slave registration
|
master during slave registration
|
||||||
|
--rowid-merge-buff-size=#
|
||||||
|
The size of the buffers used [NOT] IN evaluation via
|
||||||
|
partial matching
|
||||||
--rpl-recovery-rank=#
|
--rpl-recovery-rank=#
|
||||||
Unused, will be removed
|
Unused, will be removed
|
||||||
--safe-mode Skip some optimize stages (for testing).
|
--safe-mode Skip some optimize stages (for testing).
|
||||||
@ -608,17 +709,17 @@ The following options may be given as the first argument:
|
|||||||
--show-slave-auth-info
|
--show-slave-auth-info
|
||||||
Show user and password in SHOW SLAVE HOSTS on this
|
Show user and password in SHOW SLAVE HOSTS on this
|
||||||
master.
|
master.
|
||||||
|
--skip-bdb Deprecated option; Exist only for compatiblity with old
|
||||||
|
my.cnf files
|
||||||
--skip-grant-tables Start without grant tables. This gives all users FULL
|
--skip-grant-tables Start without grant tables. This gives all users FULL
|
||||||
ACCESS to all tables.
|
ACCESS to all tables.
|
||||||
--skip-host-cache Don't cache host names.
|
--skip-host-cache Don't cache host names.
|
||||||
--skip-name-resolve Don't resolve hostnames. All hostnames are IP's or
|
--skip-name-resolve Don't resolve hostnames. All hostnames are IP's or
|
||||||
'localhost'.
|
'localhost'.
|
||||||
--skip-networking Don't allow connection with TCP/IP
|
--skip-networking Don't allow connection with TCP/IP
|
||||||
--skip-new Don't use new, possibly wrong routines.
|
|
||||||
--skip-show-database
|
--skip-show-database
|
||||||
Don't allow 'SHOW DATABASE' commands
|
Don't allow 'SHOW DATABASE' commands
|
||||||
--skip-slave-start If set, slave is not autostarted.
|
--skip-slave-start If set, slave is not autostarted.
|
||||||
--skip-stack-trace Don't print a stack trace on failure.
|
|
||||||
--skip-thread-priority
|
--skip-thread-priority
|
||||||
Don't give threads different priorities. This option is
|
Don't give threads different priorities. This option is
|
||||||
deprecated because it has no effect; the implied behavior
|
deprecated because it has no effect; the implied behavior
|
||||||
@ -641,6 +742,12 @@ The following options may be given as the first argument:
|
|||||||
--slave-skip-errors=name
|
--slave-skip-errors=name
|
||||||
Tells the slave thread to continue replication when a
|
Tells the slave thread to continue replication when a
|
||||||
query event returns an error from the provided list
|
query event returns an error from the provided list
|
||||||
|
--slave-sql-verify-checksum
|
||||||
|
Force checksum verification of replication events after
|
||||||
|
reading them from relay log. Note: Events are always
|
||||||
|
checksum-verified by slave on receiving them from the
|
||||||
|
network before writing them to the relay log
|
||||||
|
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
|
||||||
--slave-transaction-retries=#
|
--slave-transaction-retries=#
|
||||||
Number of times the slave SQL thread will retry a
|
Number of times the slave SQL thread will retry a
|
||||||
transaction in case it failed with a deadlock or elapsed
|
transaction in case it failed with a deadlock or elapsed
|
||||||
@ -672,6 +779,8 @@ The following options may be given as the first argument:
|
|||||||
replication.
|
replication.
|
||||||
--sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual
|
--sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual
|
||||||
for the complete list of valid sql modes
|
for the complete list of valid sql modes
|
||||||
|
--stack-trace Print a symbolic stack trace on failure
|
||||||
|
(Defaults to on; use --skip-stack-trace to disable.)
|
||||||
--standalone Dummy option to start as a standalone program (NT).
|
--standalone Dummy option to start as a standalone program (NT).
|
||||||
-s, --symbolic-links
|
-s, --symbolic-links
|
||||||
Enable symbolic link support.
|
Enable symbolic link support.
|
||||||
@ -688,6 +797,9 @@ The following options may be given as the first argument:
|
|||||||
Synchronously flush relay log info to disk after every
|
Synchronously flush relay log info to disk after every
|
||||||
#th transaction. Use 0 (default) to disable synchronous
|
#th transaction. Use 0 (default) to disable synchronous
|
||||||
flushing
|
flushing
|
||||||
|
--sync-sys Enable system sync calls. Disable only when running tests
|
||||||
|
or debugging!
|
||||||
|
(Defaults to on; use --skip-sync-sys to disable.)
|
||||||
--sysdate-is-now Non-default option to alias SYSDATE() to NOW() to make it
|
--sysdate-is-now Non-default option to alias SYSDATE() to NOW() to make it
|
||||||
safe-replicable. Since 5.0, SYSDATE() returns a `dynamic'
|
safe-replicable. Since 5.0, SYSDATE() returns a `dynamic'
|
||||||
value different for different invocations, even within
|
value different for different invocations, even within
|
||||||
@ -700,18 +812,21 @@ The following options may be given as the first argument:
|
|||||||
--tc-heuristic-recover=name
|
--tc-heuristic-recover=name
|
||||||
Decision to use in heuristic recover process. Possible
|
Decision to use in heuristic recover process. Possible
|
||||||
values are COMMIT or ROLLBACK.
|
values are COMMIT or ROLLBACK.
|
||||||
|
--thread-alarm Enable system thread alarm calls. Disabling it may be
|
||||||
|
useful in debugging or testing, never do it in production
|
||||||
|
(Defaults to on; use --skip-thread-alarm to disable.)
|
||||||
--thread-cache-size=#
|
--thread-cache-size=#
|
||||||
How many threads we should keep in a cache for reuse
|
How many threads we should keep in a cache for reuse
|
||||||
--thread-handling=name
|
--thread-handling=name
|
||||||
Define threads usage for handling queries, one of
|
Define threads usage for handling queries, one of
|
||||||
one-thread-per-connection, no-threads, loaded-dynamically
|
one-thread-per-connection, no-threads
|
||||||
--thread-stack=# The stack size for each thread
|
--thread-stack=# The stack size for each thread
|
||||||
--time-format=name The TIME format (ignored)
|
--time-format=name The TIME format (ignored)
|
||||||
--timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
|
--timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
|
||||||
currently supported)
|
currently supported)
|
||||||
--tmp-table-size=# If an internal in-memory temporary table exceeds this
|
--tmp-table-size=# If an internal in-memory temporary table exceeds this
|
||||||
size, MySQL will automatically convert it to an on-disk
|
size, MySQL will automatically convert it to an on-disk
|
||||||
MyISAM table
|
MyISAM or Aria table
|
||||||
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
|
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
|
||||||
separated by a semicolon (;), in this case they are used
|
separated by a semicolon (;), in this case they are used
|
||||||
in a round-robin fashion
|
in a round-robin fashion
|
||||||
@ -731,6 +846,9 @@ The following options may be given as the first argument:
|
|||||||
of the underlying table and the query uses a LIMIT clause
|
of the underlying table and the query uses a LIMIT clause
|
||||||
(usually get from GUI tools)
|
(usually get from GUI tools)
|
||||||
-u, --user=name Run mysqld daemon as user.
|
-u, --user=name Run mysqld daemon as user.
|
||||||
|
--userstat Enables statistics gathering for USER_STATISTICS,
|
||||||
|
CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
|
||||||
|
tables in the INFORMATION_SCHEMA
|
||||||
-v, --verbose Used with --help option for detailed help.
|
-v, --verbose Used with --help option for detailed help.
|
||||||
-V, --version Output version information and exit.
|
-V, --version Output version information and exit.
|
||||||
--wait-timeout=# The number of seconds the server waits for activity on a
|
--wait-timeout=# The number of seconds the server waits for activity on a
|
||||||
@ -746,9 +864,12 @@ automatic-sp-privileges TRUE
|
|||||||
back-log 50
|
back-log 50
|
||||||
big-tables FALSE
|
big-tables FALSE
|
||||||
bind-address (No default value)
|
bind-address (No default value)
|
||||||
|
binlog-annotate-row-events FALSE
|
||||||
binlog-cache-size 32768
|
binlog-cache-size 32768
|
||||||
|
binlog-checksum NONE
|
||||||
binlog-direct-non-transactional-updates FALSE
|
binlog-direct-non-transactional-updates FALSE
|
||||||
binlog-format STATEMENT
|
binlog-format STATEMENT
|
||||||
|
binlog-optimize-thread-scheduling TRUE
|
||||||
binlog-row-event-max-size 1024
|
binlog-row-event-max-size 1024
|
||||||
binlog-stmt-cache-size 32768
|
binlog-stmt-cache-size 32768
|
||||||
bulk-insert-buffer-size 8388608
|
bulk-insert-buffer-size 8388608
|
||||||
@ -764,7 +885,11 @@ connect-timeout 10
|
|||||||
console FALSE
|
console FALSE
|
||||||
date-format %Y-%m-%d
|
date-format %Y-%m-%d
|
||||||
datetime-format %Y-%m-%d %H:%i:%s
|
datetime-format %Y-%m-%d %H:%i:%s
|
||||||
default-storage-engine InnoDB
|
deadlock-search-depth-long 15
|
||||||
|
deadlock-search-depth-short 4
|
||||||
|
deadlock-timeout-long 50000000
|
||||||
|
deadlock-timeout-short 10000
|
||||||
|
default-storage-engine myisam
|
||||||
default-time-zone (No default value)
|
default-time-zone (No default value)
|
||||||
default-week-format 0
|
default-week-format 0
|
||||||
delay-key-write ON
|
delay-key-write ON
|
||||||
@ -773,12 +898,14 @@ delayed-insert-timeout 300
|
|||||||
delayed-queue-size 1000
|
delayed-queue-size 1000
|
||||||
disconnect-slave-event-count 0
|
disconnect-slave-event-count 0
|
||||||
div-precision-increment 4
|
div-precision-increment 4
|
||||||
engine-condition-pushdown TRUE
|
engine-condition-pushdown FALSE
|
||||||
event-scheduler OFF
|
event-scheduler OFF
|
||||||
expire-logs-days 0
|
expire-logs-days 0
|
||||||
external-locking FALSE
|
external-locking FALSE
|
||||||
|
extra-max-connections 1
|
||||||
|
extra-port 0
|
||||||
flush FALSE
|
flush FALSE
|
||||||
flush-time 1800
|
flush-time 0
|
||||||
ft-boolean-syntax + -><()~*:""&|
|
ft-boolean-syntax + -><()~*:""&|
|
||||||
ft-max-word-len 84
|
ft-max-word-len 84
|
||||||
ft-min-word-len 4
|
ft-min-word-len 4
|
||||||
@ -795,11 +922,14 @@ init-rpl-role MASTER
|
|||||||
init-slave
|
init-slave
|
||||||
interactive-timeout 28800
|
interactive-timeout 28800
|
||||||
join-buffer-size 131072
|
join-buffer-size 131072
|
||||||
|
join-buffer-space-limit 2097152
|
||||||
|
join-cache-level 1
|
||||||
keep-files-on-create FALSE
|
keep-files-on-create FALSE
|
||||||
key-buffer-size 8388608
|
key-buffer-size 134217728
|
||||||
key-cache-age-threshold 300
|
key-cache-age-threshold 300
|
||||||
key-cache-block-size 1024
|
key-cache-block-size 1024
|
||||||
key-cache-division-limit 100
|
key-cache-division-limit 100
|
||||||
|
key-cache-segments 0
|
||||||
language MYSQL_SHAREDIR/
|
language MYSQL_SHAREDIR/
|
||||||
lc-messages en_US
|
lc-messages en_US
|
||||||
lc-messages-dir MYSQL_SHAREDIR/
|
lc-messages-dir MYSQL_SHAREDIR/
|
||||||
@ -816,7 +946,10 @@ log-queries-not-using-indexes FALSE
|
|||||||
log-short-format FALSE
|
log-short-format FALSE
|
||||||
log-slave-updates FALSE
|
log-slave-updates FALSE
|
||||||
log-slow-admin-statements FALSE
|
log-slow-admin-statements FALSE
|
||||||
|
log-slow-filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
|
||||||
|
log-slow-rate-limit 1
|
||||||
log-slow-slave-statements FALSE
|
log-slow-slave-statements FALSE
|
||||||
|
log-slow-verbosity
|
||||||
log-tc tc.log
|
log-tc tc.log
|
||||||
log-tc-size 24576
|
log-tc-size 24576
|
||||||
log-warnings 1
|
log-warnings 1
|
||||||
@ -825,6 +958,7 @@ low-priority-updates FALSE
|
|||||||
lower-case-table-names 1
|
lower-case-table-names 1
|
||||||
master-info-file master.info
|
master-info-file master.info
|
||||||
master-retry-count 86400
|
master-retry-count 86400
|
||||||
|
master-verify-checksum FALSE
|
||||||
max-allowed-packet 1048576
|
max-allowed-packet 1048576
|
||||||
max-binlog-cache-size 18446744073709547520
|
max-binlog-cache-size 18446744073709547520
|
||||||
max-binlog-dump-events 0
|
max-binlog-dump-events 0
|
||||||
@ -848,12 +982,13 @@ max-user-connections 0
|
|||||||
max-write-lock-count 18446744073709551615
|
max-write-lock-count 18446744073709551615
|
||||||
memlock FALSE
|
memlock FALSE
|
||||||
min-examined-row-limit 0
|
min-examined-row-limit 0
|
||||||
|
mrr-buffer-size 262144
|
||||||
multi-range-count 256
|
multi-range-count 256
|
||||||
myisam-block-size 1024
|
myisam-block-size 1024
|
||||||
myisam-data-pointer-size 6
|
myisam-data-pointer-size 6
|
||||||
myisam-max-sort-file-size 9223372036853727232
|
myisam-max-sort-file-size 9223372036853727232
|
||||||
myisam-mmap-size 18446744073709551615
|
myisam-mmap-size 18446744073709551615
|
||||||
myisam-recover-options OFF
|
myisam-recover-options DEFAULT
|
||||||
myisam-repair-threads 1
|
myisam-repair-threads 1
|
||||||
myisam-sort-buffer-size 8388608
|
myisam-sort-buffer-size 8388608
|
||||||
myisam-stats-method nulls_unequal
|
myisam-stats-method nulls_unequal
|
||||||
@ -863,14 +998,13 @@ net-buffer-length 16384
|
|||||||
net-read-timeout 30
|
net-read-timeout 30
|
||||||
net-retry-count 10
|
net-retry-count 10
|
||||||
net-write-timeout 60
|
net-write-timeout 60
|
||||||
new FALSE
|
|
||||||
old FALSE
|
old FALSE
|
||||||
old-alter-table FALSE
|
old-alter-table FALSE
|
||||||
old-passwords FALSE
|
old-passwords FALSE
|
||||||
old-style-user-limits FALSE
|
old-style-user-limits FALSE
|
||||||
optimizer-prune-level 1
|
optimizer-prune-level 1
|
||||||
optimizer-search-depth 62
|
optimizer-search-depth 62
|
||||||
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on
|
optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
performance-schema FALSE
|
performance-schema FALSE
|
||||||
performance-schema-events-waits-history-long-size 10000
|
performance-schema-events-waits-history-long-size 10000
|
||||||
performance-schema-events-waits-history-size 10
|
performance-schema-events-waits-history-size 10
|
||||||
@ -888,14 +1022,17 @@ performance-schema-max-table-instances 50000
|
|||||||
performance-schema-max-thread-classes 50
|
performance-schema-max-thread-classes 50
|
||||||
performance-schema-max-thread-instances 1000
|
performance-schema-max-thread-instances 1000
|
||||||
plugin-load (No default value)
|
plugin-load (No default value)
|
||||||
|
plugin-maturity unknown
|
||||||
port 3306
|
port 3306
|
||||||
port-open-timeout 0
|
port-open-timeout 0
|
||||||
preload-buffer-size 32768
|
preload-buffer-size 32768
|
||||||
profiling-history-size 15
|
profiling-history-size 15
|
||||||
|
progress-report-time 56
|
||||||
query-alloc-block-size 8192
|
query-alloc-block-size 8192
|
||||||
query-cache-limit 1048576
|
query-cache-limit 1048576
|
||||||
query-cache-min-res-unit 4096
|
query-cache-min-res-unit 4096
|
||||||
query-cache-size 0
|
query-cache-size 0
|
||||||
|
query-cache-strip-comments FALSE
|
||||||
query-cache-type ON
|
query-cache-type ON
|
||||||
query-cache-wlock-invalidate FALSE
|
query-cache-wlock-invalidate FALSE
|
||||||
query-prealloc-size 8192
|
query-prealloc-size 8192
|
||||||
@ -909,11 +1046,13 @@ relay-log-info-file relay-log.info
|
|||||||
relay-log-purge TRUE
|
relay-log-purge TRUE
|
||||||
relay-log-recovery FALSE
|
relay-log-recovery FALSE
|
||||||
relay-log-space-limit 0
|
relay-log-space-limit 0
|
||||||
|
replicate-annotate-row-events FALSE
|
||||||
replicate-same-server-id FALSE
|
replicate-same-server-id FALSE
|
||||||
report-host (No default value)
|
report-host (No default value)
|
||||||
report-password (No default value)
|
report-password (No default value)
|
||||||
report-port 3306
|
report-port 3306
|
||||||
report-user (No default value)
|
report-user (No default value)
|
||||||
|
rowid-merge-buff-size 8388608
|
||||||
rpl-recovery-rank 0
|
rpl-recovery-rank 0
|
||||||
safe-user-create FALSE
|
safe-user-create FALSE
|
||||||
secure-auth FALSE
|
secure-auth FALSE
|
||||||
@ -931,6 +1070,7 @@ slave-compressed-protocol FALSE
|
|||||||
slave-exec-mode STRICT
|
slave-exec-mode STRICT
|
||||||
slave-net-timeout 3600
|
slave-net-timeout 3600
|
||||||
slave-skip-errors (No default value)
|
slave-skip-errors (No default value)
|
||||||
|
slave-sql-verify-checksum TRUE
|
||||||
slave-transaction-retries 10
|
slave-transaction-retries 10
|
||||||
slave-type-conversions
|
slave-type-conversions
|
||||||
slow-launch-time 2
|
slow-launch-time 2
|
||||||
@ -938,20 +1078,23 @@ slow-query-log FALSE
|
|||||||
sort-buffer-size 2097152
|
sort-buffer-size 2097152
|
||||||
sporadic-binlog-dump-fail FALSE
|
sporadic-binlog-dump-fail FALSE
|
||||||
sql-mode
|
sql-mode
|
||||||
|
stack-trace TRUE
|
||||||
symbolic-links FALSE
|
symbolic-links FALSE
|
||||||
sync-binlog 0
|
sync-binlog 0
|
||||||
sync-frm TRUE
|
sync-frm FALSE
|
||||||
sync-master-info 0
|
sync-master-info 0
|
||||||
sync-relay-log 0
|
sync-relay-log 0
|
||||||
sync-relay-log-info 0
|
sync-relay-log-info 0
|
||||||
|
sync-sys TRUE
|
||||||
sysdate-is-now FALSE
|
sysdate-is-now FALSE
|
||||||
table-cache 400
|
table-cache 400
|
||||||
table-definition-cache 400
|
table-definition-cache 400
|
||||||
table-open-cache 400
|
table-open-cache 400
|
||||||
tc-heuristic-recover COMMIT
|
tc-heuristic-recover COMMIT
|
||||||
|
thread-alarm TRUE
|
||||||
thread-cache-size 0
|
thread-cache-size 0
|
||||||
thread-handling one-thread-per-connection
|
thread-handling one-thread-per-connection
|
||||||
thread-stack 262144
|
thread-stack 294912
|
||||||
time-format %H:%i:%s
|
time-format %H:%i:%s
|
||||||
timed-mutexes FALSE
|
timed-mutexes FALSE
|
||||||
tmp-table-size 16777216
|
tmp-table-size 16777216
|
||||||
@ -959,6 +1102,7 @@ transaction-alloc-block-size 8192
|
|||||||
transaction-isolation REPEATABLE-READ
|
transaction-isolation REPEATABLE-READ
|
||||||
transaction-prealloc-size 4096
|
transaction-prealloc-size 4096
|
||||||
updatable-views-with-limit YES
|
updatable-views-with-limit YES
|
||||||
|
userstat FALSE
|
||||||
verbose TRUE
|
verbose TRUE
|
||||||
wait-timeout 28800
|
wait-timeout 28800
|
||||||
|
|
||||||
|
@ -148,10 +148,10 @@ insert into t1 values
|
|||||||
(7,7), (8,8), (9,9), (10,10), (11,11), (12,12);
|
(7,7), (8,8), (9,9), (10,10), (11,11), (12,12);
|
||||||
explain select * from t1 where a between 2 and 3;
|
explain select * from t1 where a between 2 and 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
|
1 SIMPLE t1 range idx idx 4 NULL 2 Using index condition
|
||||||
explain select * from t1 where a between 2 and 3 or b is null;
|
explain select * from t1 where a between 2 and 3 or b is null;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
|
1 SIMPLE t1 range idx idx 4 NULL 2 Using index condition
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select cast(NULL as signed);
|
select cast(NULL as signed);
|
||||||
cast(NULL as signed)
|
cast(NULL as signed)
|
||||||
|
@ -76,13 +76,13 @@ insert into t2 select * from t1;
|
|||||||
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
||||||
explain select * from t1 where a is null and b = 2;
|
explain select * from t1 where a is null and b = 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a is null and b = 2 and c=0;
|
explain select * from t1 where a is null and b = 2 and c=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a is null and b = 7 and c=0;
|
explain select * from t1 where a is null and b = 7 and c=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a=2 and b = 2;
|
explain select * from t1 where a=2 and b = 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 1 Using where
|
1 SIMPLE t1 ref a,b a 5 const 1 Using where
|
||||||
@ -91,25 +91,25 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where
|
||||||
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
|
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a,b a 5 NULL 5 Using where
|
1 SIMPLE t1 range a,b a 5 NULL 5 Using index condition; Using where
|
||||||
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
|
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where
|
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using index condition; Using where
|
||||||
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
|
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a > 1 and a < 3 limit 1;
|
explain select * from t1 where a > 1 and a < 3 limit 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 1 Using where
|
1 SIMPLE t1 range a a 5 NULL 1 Using index condition
|
||||||
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
|
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a,b a 5 NULL 4 Using where
|
1 SIMPLE t1 range a,b a 5 NULL 4 Using index condition; Using where
|
||||||
explain select * from t1 where a > 8 and a < 9;
|
explain select * from t1 where a > 8 and a < 9;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 1 Using where
|
1 SIMPLE t1 range a a 5 NULL 1 Using index condition
|
||||||
explain select * from t1 where b like "6%";
|
explain select * from t1 where b like "6%";
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range b b 12 NULL 1 Using where
|
1 SIMPLE t1 range b b 12 NULL 1 Using where
|
||||||
@ -258,7 +258,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
|
|||||||
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
|
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
|
||||||
explain select id from t1 where uniq_id is null;
|
explain select id from t1 where uniq_id is null;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where
|
1 SIMPLE t1 ref idx1 idx1 5 const 5 Using index condition
|
||||||
explain select id from t1 where uniq_id =1;
|
explain select id from t1 where uniq_id =1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const idx1 idx1 5 const 1
|
1 SIMPLE t1 const idx1 idx1 5 const 1
|
||||||
|
@ -515,7 +515,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
|
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
|
||||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
`titre` char(80) NOT NULL default '',
|
`titre` char(80) NOT NULL default '',
|
||||||
@ -612,10 +612,10 @@ DS-MRR: use two IGNORE INDEX queries, otherwise we get cost races, because
|
|||||||
DS-MRR: records_in_range/read_time return the same numbers for all three indexes
|
DS-MRR: records_in_range/read_time return the same numbers for all three indexes
|
||||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX (LongField, StringField) WHERE FieldKey > '2' ORDER BY LongVal;
|
EXPLAIN SELECT * FROM t1 IGNORE INDEX (LongField, StringField) WHERE FieldKey > '2' ORDER BY LongVal;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range FieldKey FieldKey 38 NULL 4 Using where; Using filesort
|
1 SIMPLE t1 range FieldKey FieldKey 38 NULL 4 Using index condition; Using filesort
|
||||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal;
|
EXPLAIN SELECT * FROM t1 IGNORE INDEX (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range StringField StringField 38 NULL 4 Using where; Using filesort
|
1 SIMPLE t1 range StringField StringField 38 NULL 4 Using index condition; Using filesort
|
||||||
SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
|
SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
|
||||||
FieldKey LongVal StringVal
|
FieldKey LongVal StringVal
|
||||||
3 1 2
|
3 1 2
|
||||||
@ -645,7 +645,7 @@ insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
|
|||||||
insert into t1 values (12, 11), (11, 11), (14, 3), (13, 5), (16, 12), (15, 12);
|
insert into t1 values (12, 11), (11, 11), (14, 3), (13, 5), (16, 12), (15, 12);
|
||||||
explain select * from t1 where b=1 or b is null order by a;
|
explain select * from t1 where b=1 or b is null order by a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref_or_null b b 5 const 4 Using where; Using filesort
|
1 SIMPLE t1 ref_or_null b b 5 const 4 Using index condition; Using where; Using filesort
|
||||||
select * from t1 where b=1 or b is null order by a;
|
select * from t1 where b=1 or b is null order by a;
|
||||||
a b
|
a b
|
||||||
1 1
|
1 1
|
||||||
@ -654,7 +654,7 @@ a b
|
|||||||
4 NULL
|
4 NULL
|
||||||
explain select * from t1 where b=2 or b is null order by a;
|
explain select * from t1 where b=2 or b is null order by a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref_or_null b b 5 const 3 Using where; Using filesort
|
1 SIMPLE t1 ref_or_null b b 5 const 3 Using index condition; Using where; Using filesort
|
||||||
select * from t1 where b=2 or b is null order by a;
|
select * from t1 where b=2 or b is null order by a;
|
||||||
a b
|
a b
|
||||||
3 NULL
|
3 NULL
|
||||||
@ -1114,7 +1114,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 index k2 k3 5 NULL 73 Using where
|
1 SIMPLE t2 index k2 k3 5 NULL 73 Using where
|
||||||
EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 20 AND 30 ORDER BY c3 LIMIT 4000;
|
EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 20 AND 30 ORDER BY c3 LIMIT 4000;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range k2 k2 5 NULL 386 Using where; Using filesort
|
1 SIMPLE t2 range k2 k2 5 NULL 386 Using index condition; Using filesort
|
||||||
SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20;
|
SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20;
|
||||||
id c3
|
id c3
|
||||||
6 14
|
6 14
|
||||||
@ -1492,8 +1492,8 @@ SELECT d FROM t1, t2
|
|||||||
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
|
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
|
||||||
ORDER BY t2.c LIMIT 1;
|
ORDER BY t2.c LIMIT 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b b 4 const 4 Using where; Using temporary; Using filesort
|
1 SIMPLE t1 ref a,b b 4 const 4 Using index condition; Using where; Using temporary; Using filesort
|
||||||
1 SIMPLE t2 ref a,b,c a 40 test.t1.a,const 11 Using where
|
1 SIMPLE t2 ref a,b,c a 40 test.t1.a,const 11 Using index condition
|
||||||
SELECT d FROM t1, t2
|
SELECT d FROM t1, t2
|
||||||
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
|
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
|
||||||
ORDER BY t2.c LIMIT 1;
|
ORDER BY t2.c LIMIT 1;
|
||||||
@ -1628,19 +1628,19 @@ INSERT INTO t2 SELECT a+4, b FROM t2;
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 FORCE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
SELECT * FROM t1 FORCE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort
|
1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Using temporary; Using filesort
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
|
||||||
# should have "using filesort"
|
# should have "using filesort"
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 USE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
SELECT * FROM t1 USE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort
|
1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Using temporary; Using filesort
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
|
||||||
# should have "using filesort"
|
# should have "using filesort"
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort
|
1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Using temporary; Using filesort
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
|
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
#
|
#
|
||||||
|
@ -3765,3 +3765,64 @@ date('2010-10-10') between '2010-09-09' and ?
|
|||||||
execute stmt using @a;
|
execute stmt using @a;
|
||||||
date('2010-10-10') between '2010-09-09' and ?
|
date('2010-10-10') between '2010-09-09' and ?
|
||||||
0
|
0
|
||||||
|
#
|
||||||
|
# Bug #892725: look-up is changed for a full scan when executing PS
|
||||||
|
#
|
||||||
|
create table t1 (a int primary key, b int);
|
||||||
|
insert into t1 values
|
||||||
|
(7,70), (3,40), (4,40), (8,70), (1,70), (9,50), (2,70);
|
||||||
|
prepare st from 'select * from t1 where a=8';
|
||||||
|
flush status;
|
||||||
|
execute st;
|
||||||
|
a b
|
||||||
|
8 70
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
Variable_name Value
|
||||||
|
Handler_read_first 0
|
||||||
|
Handler_read_key 1
|
||||||
|
Handler_read_last 0
|
||||||
|
Handler_read_next 0
|
||||||
|
Handler_read_prev 0
|
||||||
|
Handler_read_rnd 0
|
||||||
|
Handler_read_rnd_next 0
|
||||||
|
flush status;
|
||||||
|
execute st;
|
||||||
|
a b
|
||||||
|
8 70
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
Variable_name Value
|
||||||
|
Handler_read_first 0
|
||||||
|
Handler_read_key 1
|
||||||
|
Handler_read_last 0
|
||||||
|
Handler_read_next 0
|
||||||
|
Handler_read_prev 0
|
||||||
|
Handler_read_rnd 0
|
||||||
|
Handler_read_rnd_next 0
|
||||||
|
flush status;
|
||||||
|
select * from t1 use index() where a=3;
|
||||||
|
a b
|
||||||
|
3 40
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
Variable_name Value
|
||||||
|
Handler_read_first 0
|
||||||
|
Handler_read_key 0
|
||||||
|
Handler_read_last 0
|
||||||
|
Handler_read_next 0
|
||||||
|
Handler_read_prev 0
|
||||||
|
Handler_read_rnd 0
|
||||||
|
Handler_read_rnd_next 8
|
||||||
|
flush status;
|
||||||
|
execute st;
|
||||||
|
a b
|
||||||
|
8 70
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
Variable_name Value
|
||||||
|
Handler_read_first 0
|
||||||
|
Handler_read_key 1
|
||||||
|
Handler_read_last 0
|
||||||
|
Handler_read_next 0
|
||||||
|
Handler_read_prev 0
|
||||||
|
Handler_read_rnd 0
|
||||||
|
Handler_read_rnd_next 0
|
||||||
|
deallocate prepare st;
|
||||||
|
drop table t1;
|
||||||
|
@ -467,9 +467,9 @@ def key 253 64 7 Y 0 31 8
|
|||||||
def key_len 253 4096 1 Y 0 31 8
|
def key_len 253 4096 1 Y 0 31 8
|
||||||
def ref 253 2048 0 Y 0 31 8
|
def ref 253 2048 0 Y 0 31 8
|
||||||
def rows 8 10 1 Y 32928 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 27 N 1 31 8
|
def Extra 253 255 37 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using filesort
|
||||||
drop table if exists t2;
|
drop table if exists t2;
|
||||||
create table t2 (id smallint, name varchar(20)) ;
|
create table t2 (id smallint, name varchar(20)) ;
|
||||||
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
|
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
|
||||||
|
@ -221,27 +221,27 @@ update t1 set y=x;
|
|||||||
explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0;
|
explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref y y 5 const 1
|
1 SIMPLE t1 ref y y 5 const 1
|
||||||
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join)
|
||||||
explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0;
|
explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref y y 5 const 1
|
1 SIMPLE t1 ref y y 5 const 1
|
||||||
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join)
|
||||||
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
|
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref y y 5 const 1
|
1 SIMPLE t1 ref y y 5 const 1
|
||||||
1 SIMPLE t2 range x x 5 NULL 3 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using join buffer (flat, BNL join)
|
||||||
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
|
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref y y 5 const 1
|
1 SIMPLE t1 ref y y 5 const 1
|
||||||
1 SIMPLE t2 range x x 5 NULL 3 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using join buffer (flat, BNL join)
|
||||||
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
|
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref y y 5 const 1
|
1 SIMPLE t1 ref y y 5 const 1
|
||||||
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join)
|
||||||
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
|
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref y y 5 const 1
|
1 SIMPLE t1 ref y y 5 const 1
|
||||||
1 SIMPLE t2 range x x 5 NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using join buffer (flat, BNL join)
|
||||||
explain select count(*) from t1 where x in (1);
|
explain select count(*) from t1 where x in (1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref x x 5 const 1 Using index
|
1 SIMPLE t1 ref x x 5 const 1 Using index
|
||||||
@ -276,7 +276,7 @@ INSERT INTO t1 VALUES
|
|||||||
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
|
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
|
||||||
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a,b a 5 NULL 2 Using where
|
1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where
|
||||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||||
a b
|
a b
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -421,19 +421,19 @@ test.t1 analyze status OK
|
|||||||
test.t2 analyze status Table is already up to date
|
test.t2 analyze status Table is already up to date
|
||||||
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
|
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using where
|
1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition
|
||||||
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
||||||
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
|
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using where
|
1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition
|
||||||
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
||||||
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
|
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using where
|
1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using index condition
|
||||||
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
||||||
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
|
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using where
|
1 SIMPLE t1 range uid_index uid_index 4 NULL 113 Using index condition
|
||||||
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
|
||||||
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
|
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
|
||||||
id name uid id name uid
|
id name uid id name uid
|
||||||
@ -615,13 +615,13 @@ INSERT INTO t1 (a) VALUES
|
|||||||
('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
|
('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
|
||||||
explain select * from t1 where a='aaa';
|
explain select * from t1 where a='aaa';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a a 11 const 2 Using where
|
1 SIMPLE t1 ref a a 11 const 2 Using index condition
|
||||||
explain select * from t1 where a=binary 'aaa';
|
explain select * from t1 where a=binary 'aaa';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 11 NULL 2 Using where
|
1 SIMPLE t1 range a a 11 NULL 2 Using index condition
|
||||||
explain select * from t1 where a='aaa' collate latin1_bin;
|
explain select * from t1 where a='aaa' collate latin1_bin;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 11 NULL 2 Using where
|
1 SIMPLE t1 range a a 11 NULL 2 Using index condition
|
||||||
explain select * from t1 where a='aaa' collate latin1_german1_ci;
|
explain select * from t1 where a='aaa' collate latin1_german1_ci;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where
|
1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where
|
||||||
@ -716,7 +716,7 @@ WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
|
|||||||
v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
|
v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
|
||||||
s.oxleft > v.oxleft AND s.oxleft < v.oxright;
|
s.oxleft > v.oxleft AND s.oxleft < v.oxright;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE v ref OXLEFT,OXRIGHT,OXROOTID OXROOTID 34 const 5 Using where
|
1 SIMPLE v ref OXLEFT,OXRIGHT,OXROOTID OXROOTID 34 const 5 Using index condition
|
||||||
1 SIMPLE s ALL OXLEFT NULL NULL NULL 12 Range checked for each record (index map: 0x4)
|
1 SIMPLE s ALL OXLEFT NULL NULL NULL 12 Range checked for each record (index map: 0x4)
|
||||||
SELECT s.oxid FROM t1 v, t1 s
|
SELECT s.oxid FROM t1 v, t1 s
|
||||||
WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
|
WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
|
||||||
@ -890,10 +890,10 @@ INSERT INTO t1 VALUES
|
|||||||
(55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C');
|
(55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C');
|
||||||
EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
|
EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range status status 23 NULL 11 Using where
|
1 SIMPLE t1 range status status 23 NULL 11 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B');
|
EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range status status 23 NULL 11 Using where
|
1 SIMPLE t1 range status status 23 NULL 11 Using index condition
|
||||||
SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
|
SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
|
||||||
id status
|
id status
|
||||||
53 C
|
53 C
|
||||||
@ -922,10 +922,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 range status status 23 NULL 11 Using where; Using index
|
1 SIMPLE t1 range status status 23 NULL 11 Using where; Using index
|
||||||
EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
|
EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range status status 23 NULL 10 Using where
|
1 SIMPLE t1 range status status 23 NULL 10 Using index condition
|
||||||
EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B';
|
EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range status status 23 NULL 10 Using where
|
1 SIMPLE t1 range status status 23 NULL 10 Using index condition; Using where
|
||||||
SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
|
SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
|
||||||
id status
|
id status
|
||||||
53 C
|
53 C
|
||||||
@ -1026,20 +1026,20 @@ create table t2 (a varchar(10), filler char(200), key(a));
|
|||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
explain select * from t1 where a between 'a' and 'a ';
|
explain select * from t1 where a between 'a' and 'a ';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 13 NULL # Using where
|
1 SIMPLE t1 range a a 13 NULL # Using index condition
|
||||||
explain select * from t1 where a = 'a' or a='a ';
|
explain select * from t1 where a = 'a' or a='a ';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 13 NULL # Using where
|
1 SIMPLE t1 range a a 13 NULL # Using index condition; Using where
|
||||||
explain select * from t2 where a between 'a' and 'a ';
|
explain select * from t2 where a between 'a' and 'a ';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref a a 13 const # Using where
|
1 SIMPLE t2 ref a a 13 const # Using index condition
|
||||||
explain select * from t2 where a = 'a' or a='a ';
|
explain select * from t2 where a = 'a' or a='a ';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref a a 13 const # Using where
|
1 SIMPLE t2 ref a a 13 const # Using index condition; Using where
|
||||||
update t1 set a='b' where a<>'a';
|
update t1 set a='b' where a<>'a';
|
||||||
explain select * from t1 where a not between 'b' and 'b';
|
explain select * from t1 where a not between 'b' and 'b';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 13 NULL # Using where
|
1 SIMPLE t1 range a a 13 NULL # Using index condition
|
||||||
select a, hex(filler) from t1 where a not between 'b' and 'b';
|
select a, hex(filler) from t1 where a not between 'b' and 'b';
|
||||||
a hex(filler)
|
a hex(filler)
|
||||||
a 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
a 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -1083,7 +1083,7 @@ id b c
|
|||||||
0 3 4
|
0 3 4
|
||||||
EXPLAIN SELECT * FROM t1 WHERE b<=3 AND 3<=c;
|
EXPLAIN SELECT * FROM t1 WHERE b<=3 AND 3<=c;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where
|
1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using index condition; Using where
|
||||||
EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
|
EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where
|
1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 3 Using where
|
||||||
@ -1115,7 +1115,7 @@ INSERT INTO t1 VALUES
|
|||||||
('A2','2005-12-01 08:00:00',1000);
|
('A2','2005-12-01 08:00:00',1000);
|
||||||
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where
|
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition
|
||||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||||
item started price
|
item started price
|
||||||
Warnings:
|
Warnings:
|
||||||
@ -1153,7 +1153,7 @@ INSERT INTO t1 VALUES
|
|||||||
This must use range access:
|
This must use range access:
|
||||||
explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
|
explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where
|
1 SIMPLE t1 range dateval dateval 4 NULL 2 Using index condition
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
a varchar(32), index (a)
|
a varchar(32), index (a)
|
||||||
@ -1219,7 +1219,7 @@ Z
|
|||||||
In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)
|
In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)
|
||||||
explain select * from t2 where a=1000 and b<11;
|
explain select * from t2 where a=1000 and b<11;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref a a 5 const 502 Using where
|
1 SIMPLE t2 ref a a 5 const 502 Using index condition
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
|
CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
|
||||||
CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
|
CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
|
||||||
@ -1690,7 +1690,7 @@ pk i4
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
|
SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 3 Using where
|
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 3 Using index condition
|
||||||
SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
|
SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
|
||||||
pk i4
|
pk i4
|
||||||
1 10
|
1 10
|
||||||
@ -1699,7 +1699,7 @@ pk i4
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
|
SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using where
|
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using index condition
|
||||||
SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
|
SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
|
||||||
pk i4
|
pk i4
|
||||||
1 10
|
1 10
|
||||||
@ -1733,7 +1733,7 @@ pk i4
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
|
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using where
|
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using index condition
|
||||||
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
|
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
|
||||||
pk i4
|
pk i4
|
||||||
1 10
|
1 10
|
||||||
@ -1748,7 +1748,7 @@ pk i4
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
|
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using where
|
1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using index condition
|
||||||
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
|
SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
|
||||||
pk i4
|
pk i4
|
||||||
1 10
|
1 10
|
||||||
@ -1757,14 +1757,14 @@ EXPLAIN
|
|||||||
SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
|
SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL i4_uq NULL NULL NULL 3
|
1 SIMPLE t1 ALL i4_uq NULL NULL NULL 3
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition
|
||||||
SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
|
SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
|
||||||
pk i4 pk i4
|
pk i4 pk i4
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
|
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL i4_uq NULL NULL NULL 3
|
1 SIMPLE t1 ALL i4_uq NULL NULL NULL 3
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition
|
||||||
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
|
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
|
||||||
pk i4 pk i4
|
pk i4 pk i4
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -1793,7 +1793,7 @@ INSERT INTO t100(I,J) VALUES(8,26);
|
|||||||
|
|
||||||
EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
|
EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t100 range I I 10 NULL 4 Using where
|
1 SIMPLE t100 range I I 10 NULL 4 Using index condition; Using where
|
||||||
|
|
||||||
SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
|
SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
|
||||||
K I J
|
K I J
|
||||||
|
@ -49,14 +49,14 @@ SELECT * FROM City
|
|||||||
WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
|
WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
|
||||||
(Population < 100000 OR Name Like 'T%') AND Country='ARG';
|
(Population < 100000 OR Name Like 'T%') AND Country='ARG';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Country,Name Country 3 NULL 104 Using where
|
1 SIMPLE City range Population,Country,Name Country 3 NULL 104 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Population < 200000 AND Name LIKE 'P%' AND
|
WHERE Population < 200000 AND Name LIKE 'P%' AND
|
||||||
(Population > 300000 OR Name LIKE 'T%') AND
|
(Population > 300000 OR Name LIKE 'T%') AND
|
||||||
(Population < 100000 OR Name LIKE 'Pa%');
|
(Population < 100000 OR Name LIKE 'Pa%');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Name Name 35 NULL 135 Using where
|
1 SIMPLE City range Population,Name Name 35 NULL 135 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
|
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
|
||||||
@ -69,12 +69,12 @@ EXPLAIN
|
|||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Population > 101000 AND Population < 115000);
|
WHERE (Population > 101000 AND Population < 115000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 459 Using where
|
1 SIMPLE City range Population Population 4 NULL 459 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Population > 101000 AND Population < 102000);
|
WHERE (Population > 101000 AND Population < 102000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 39 Using where
|
1 SIMPLE City range Population Population 4 NULL 39 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'));
|
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'));
|
||||||
@ -91,7 +91,7 @@ SELECT * FROM City
|
|||||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
||||||
AND (Population > 101000 AND Population < 102000);
|
AND (Population > 101000 AND Population < 102000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Country,Name Population 4 NULL 39 Using where
|
1 SIMPLE City range Population,Country,Name Population 4 NULL 39 Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
||||||
AND (Population > 101000 AND Population < 115000);
|
AND (Population > 101000 AND Population < 115000);
|
||||||
@ -171,37 +171,37 @@ ID Name Country Population
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name < 'Ac');
|
SELECT * FROM City WHERE (Name < 'Ac');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 13 Using where
|
1 SIMPLE City range Name Name 35 NULL 13 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name < 'Bb');
|
SELECT * FROM City WHERE (Name < 'Bb');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 208 Using where
|
1 SIMPLE City range Name Name 35 NULL 208 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Country > 'A' AND Country < 'B');
|
SELECT * FROM City WHERE (Country > 'A' AND Country < 'B');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 104 Using where
|
1 SIMPLE City range Country Country 3 NULL 104 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb');
|
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 39 Using where
|
1 SIMPLE City range Name Name 35 NULL 39 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S');
|
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 221 Using where
|
1 SIMPLE City range Name Name 35 NULL 221 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 110000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 110000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 328 Using where
|
1 SIMPLE City range Population Population 4 NULL 328 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 103000 AND Population < 104000);
|
SELECT * FROM City WHERE (Population > 103000 AND Population < 104000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 37 Using where
|
1 SIMPLE City range Population Population 4 NULL 37 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
||||||
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
|
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Country,Name Name 35 NULL 52 Using where
|
1 SIMPLE City range Population,Country,Name Name 35 NULL 52 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
||||||
@ -327,11 +327,11 @@ ID Name Country Population
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110);
|
SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 21 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 21 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200);
|
SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 201 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 201 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500);
|
SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
@ -339,22 +339,22 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG';
|
SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 19 Using where
|
1 SIMPLE City range Country Country 3 NULL 19 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ;
|
SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 222 Using where
|
1 SIMPLE City range Name Name 35 NULL 222 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ;
|
SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 72 Using where
|
1 SIMPLE City range Name Name 35 NULL 72 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
||||||
OR ((ID BETWEEN 100 AND 110) AND
|
OR ((ID BETWEEN 100 AND 110) AND
|
||||||
(Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
|
(Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 21 Using where
|
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 21 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
|
WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
|
||||||
@ -576,39 +576,39 @@ ID Name Country Population
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Population > 101000 AND Population < 102000;
|
SELECT * FROM City WHERE Population > 101000 AND Population < 102000;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 39 Using where
|
1 SIMPLE City range Population Population 4 NULL 39 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Population > 101000 AND Population < 110000;
|
SELECT * FROM City WHERE Population > 101000 AND Population < 110000;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 328 Using where
|
1 SIMPLE City range Population Population 4 NULL 328 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country < 'C';
|
SELECT * FROM City WHERE Country < 'C';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 436 Using where
|
1 SIMPLE City range Country Country 3 NULL 436 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country < 'AGO';
|
SELECT * FROM City WHERE Country < 'AGO';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 6 Using where
|
1 SIMPLE City range Country Country 3 NULL 6 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S';
|
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 221 Using where
|
1 SIMPLE City range Name Name 35 NULL 221 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb';
|
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 39 Using where
|
1 SIMPLE City range Name Name 35 NULL 39 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 401 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 401 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'P%';
|
SELECT * FROM City WHERE Name LIKE 'P%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 135 Using where
|
1 SIMPLE City range Name Name 35 NULL 135 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 102000) AND
|
WHERE ((Population > 101000 AND Population < 102000) AND
|
||||||
@ -679,23 +679,23 @@ CREATE INDEX CountryPopulation ON City(Country,Population);
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'Pas%';
|
SELECT * FROM City WHERE Name LIKE 'Pas%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 5 Using where
|
1 SIMPLE City range Name Name 35 NULL 5 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'P%';
|
SELECT * FROM City WHERE Name LIKE 'P%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 135 Using where
|
1 SIMPLE City range Name Name 35 NULL 135 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 81 Using where
|
1 SIMPLE City range Population Population 4 NULL 81 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='USA';
|
SELECT * FROM City WHERE Country='USA';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation Country 3 const 267 Using where
|
1 SIMPLE City ref Country,CountryPopulation Country 3 const 267 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='FIN';
|
SELECT * FROM City WHERE Country='FIN';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation Country 3 const 6 Using where
|
1 SIMPLE City ref Country,CountryPopulation Country 3 const 6 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
||||||
@ -707,7 +707,7 @@ SELECT * FROM City
|
|||||||
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
|
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
|
||||||
AND Country='FIN';
|
AND Country='FIN';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Population,Country,Name,CountryPopulation Country 3 const 6 Using where
|
1 SIMPLE City ref Population,Country,Name,CountryPopulation Country 3 const 6 Using index condition; Using where
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
||||||
AND Country='USA';
|
AND Country='USA';
|
||||||
@ -752,51 +752,51 @@ CREATE INDEX CountryName ON City(Country,Name);
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='USA';
|
SELECT * FROM City WHERE Country='USA';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 267 Using where
|
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 267 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='FIN';
|
SELECT * FROM City WHERE Country='FIN';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 5 Using where
|
1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 5 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='BRA';
|
SELECT * FROM City WHERE Country='BRA';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 221 Using where
|
1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 221 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035;
|
SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032;
|
SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 301 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 301 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300;
|
SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 250 and 260 ;
|
SELECT * FROM City WHERE ID BETWEEN 250 and 260 ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 102000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 102000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 39 Using where
|
1 SIMPLE City range Population Population 4 NULL 39 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 81 Using where
|
1 SIMPLE City range Population Population 4 NULL 81 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'Pa%';
|
SELECT * FROM City WHERE Name LIKE 'Pa%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 41 Using where
|
1 SIMPLE City range Name Name 35 NULL 41 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 102000) OR
|
WHERE ((Population > 101000 AND Population < 102000) OR
|
||||||
@ -817,7 +817,7 @@ WHERE ((Population > 101000 AND Population < 110000) OR
|
|||||||
ID BETWEEN 3500 AND 3800) AND Country='FIN'
|
ID BETWEEN 3500 AND 3800) AND Country='FIN'
|
||||||
AND (Name BETWEEN 'P' AND 'T' OR ID BETWEEN 4000 AND 4300);
|
AND (Name BETWEEN 'P' AND 'T' OR ID BETWEEN 4000 AND 4300);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 3 const 5 Using where
|
1 SIMPLE City ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 3 const 5 Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE ((Population > 101000 AND Population < 102000) OR
|
WHERE ((Population > 101000 AND Population < 102000) OR
|
||||||
ID BETWEEN 3790 AND 3800) AND Country='USA'
|
ID BETWEEN 3790 AND 3800) AND Country='USA'
|
||||||
@ -949,7 +949,7 @@ WHERE ((Population > 101000 AND Population < 11000) OR
|
|||||||
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
||||||
AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300);
|
AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 38 NULL 23 Using where
|
1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 38 NULL 23 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 11000) OR
|
WHERE ((Population > 101000 AND Population < 11000) OR
|
||||||
@ -1414,4 +1414,30 @@ a b c d
|
|||||||
0 75 5 3
|
0 75 5 3
|
||||||
SET SESSION optimizer_switch=DEFAULT;
|
SET SESSION optimizer_switch=DEFAULT;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a int NOT NULL PRIMARY KEY, b int, c int, INDEX idx(c,b));
|
||||||
|
INSERT INTO t1 VALUES (19,1,NULL), (20,5,7);
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||||
|
(t1.c=0 OR t1.a=500);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range PRIMARY,idx PRIMARY 4 NULL 1 Using index condition; Using where
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||||
|
(t1.c=0 OR t1.a=500);
|
||||||
|
a b c
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX idx(b));
|
||||||
|
INSERT INTO t1 VALUES (167,9999), (168,10000);
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL PRIMARY,idx NULL NULL NULL 2 Using where
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||||
|
a b
|
||||||
|
167 9999
|
||||||
|
168 10000
|
||||||
|
DROP TABLE t1;
|
||||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||||
|
@ -50,14 +50,14 @@ SELECT * FROM City
|
|||||||
WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
|
WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
|
||||||
(Population < 100000 OR Name Like 'T%') AND Country='ARG';
|
(Population < 100000 OR Name Like 'T%') AND Country='ARG';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Country,Name Country 3 NULL 106 Using where
|
1 SIMPLE City range Population,Country,Name Country 3 NULL 106 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Population < 200000 AND Name LIKE 'P%' AND
|
WHERE Population < 200000 AND Name LIKE 'P%' AND
|
||||||
(Population > 300000 OR Name LIKE 'T%') AND
|
(Population > 300000 OR Name LIKE 'T%') AND
|
||||||
(Population < 100000 OR Name LIKE 'Pa%');
|
(Population < 100000 OR Name LIKE 'Pa%');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Name Name 35 NULL 235 Using where
|
1 SIMPLE City range Population,Name Name 35 NULL 235 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
|
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
|
||||||
@ -70,12 +70,12 @@ EXPLAIN
|
|||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Population > 101000 AND Population < 115000);
|
WHERE (Population > 101000 AND Population < 115000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 458 Using where
|
1 SIMPLE City range Population Population 4 NULL 458 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Population > 101000 AND Population < 102000);
|
WHERE (Population > 101000 AND Population < 102000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 38 Using where
|
1 SIMPLE City range Population Population 4 NULL 38 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'));
|
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'));
|
||||||
@ -92,7 +92,7 @@ SELECT * FROM City
|
|||||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
||||||
AND (Population > 101000 AND Population < 102000);
|
AND (Population > 101000 AND Population < 102000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Country,Name Population 4 NULL 38 Using where
|
1 SIMPLE City range Population,Country,Name Population 4 NULL 38 Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
|
||||||
AND (Population > 101000 AND Population < 115000);
|
AND (Population > 101000 AND Population < 115000);
|
||||||
@ -172,37 +172,37 @@ ID Name Country Population
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name < 'Ac');
|
SELECT * FROM City WHERE (Name < 'Ac');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 23 Using where
|
1 SIMPLE City range Name Name 35 NULL 23 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name < 'Bb');
|
SELECT * FROM City WHERE (Name < 'Bb');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 373 Using where
|
1 SIMPLE City range Name Name 35 NULL 373 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Country > 'A' AND Country < 'B');
|
SELECT * FROM City WHERE (Country > 'A' AND Country < 'B');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 106 Using where
|
1 SIMPLE City range Country Country 3 NULL 106 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb');
|
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 71 Using where
|
1 SIMPLE City range Name Name 35 NULL 71 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S');
|
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 384 Using where
|
1 SIMPLE City range Name Name 35 NULL 384 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 110000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 110000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 327 Using where
|
1 SIMPLE City range Population Population 4 NULL 327 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 103000 AND Population < 104000);
|
SELECT * FROM City WHERE (Population > 103000 AND Population < 104000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 36 Using where
|
1 SIMPLE City range Population Population 4 NULL 36 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
||||||
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
|
(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population,Country,Name Name 35 NULL 94 Using where
|
1 SIMPLE City range Population,Country,Name Name 35 NULL 94 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
|
||||||
@ -328,34 +328,34 @@ ID Name Country Population
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110);
|
SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 20 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 20 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200);
|
SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 200 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 200 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500);
|
SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 1198 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 1198 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG';
|
SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 19 Using where
|
1 SIMPLE City range Country Country 3 NULL 19 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ;
|
SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 394 Using where
|
1 SIMPLE City range Name Name 35 NULL 394 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ;
|
SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 133 Using where
|
1 SIMPLE City range Name Name 35 NULL 133 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
||||||
OR ((ID BETWEEN 100 AND 110) AND
|
OR ((ID BETWEEN 100 AND 110) AND
|
||||||
(Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
|
(Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using where
|
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
|
WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
|
||||||
@ -369,7 +369,7 @@ WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
|
|||||||
OR ((ID BETWEEN 100 AND 200) AND
|
OR ((ID BETWEEN 100 AND 200) AND
|
||||||
(Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
|
(Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where
|
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
|
||||||
OR ((ID BETWEEN 100 AND 110) AND
|
OR ((ID BETWEEN 100 AND 110) AND
|
||||||
@ -577,39 +577,39 @@ ID Name Country Population
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Population > 101000 AND Population < 102000;
|
SELECT * FROM City WHERE Population > 101000 AND Population < 102000;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 38 Using where
|
1 SIMPLE City range Population Population 4 NULL 38 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Population > 101000 AND Population < 110000;
|
SELECT * FROM City WHERE Population > 101000 AND Population < 110000;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 327 Using where
|
1 SIMPLE City range Population Population 4 NULL 327 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country < 'C';
|
SELECT * FROM City WHERE Country < 'C';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 446 Using where
|
1 SIMPLE City range Country Country 3 NULL 446 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country < 'AGO';
|
SELECT * FROM City WHERE Country < 'AGO';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Country Country 3 NULL 5 Using where
|
1 SIMPLE City range Country Country 3 NULL 5 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S';
|
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 384 Using where
|
1 SIMPLE City range Name Name 35 NULL 384 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb';
|
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 71 Using where
|
1 SIMPLE City range Name Name 35 NULL 71 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 400 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 400 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'P%';
|
SELECT * FROM City WHERE Name LIKE 'P%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 235 Using where
|
1 SIMPLE City range Name Name 35 NULL 235 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 102000) AND
|
WHERE ((Population > 101000 AND Population < 102000) AND
|
||||||
@ -680,23 +680,23 @@ CREATE INDEX CountryPopulation ON City(Country,Population);
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'Pas%';
|
SELECT * FROM City WHERE Name LIKE 'Pas%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 8 Using where
|
1 SIMPLE City range Name Name 35 NULL 8 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'P%';
|
SELECT * FROM City WHERE Name LIKE 'P%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 235 Using where
|
1 SIMPLE City range Name Name 35 NULL 235 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 80 Using where
|
1 SIMPLE City range Population Population 4 NULL 80 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='USA';
|
SELECT * FROM City WHERE Country='USA';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation Country 3 const 274 Using where
|
1 SIMPLE City ref Country,CountryPopulation Country 3 const 274 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='FIN';
|
SELECT * FROM City WHERE Country='FIN';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation Country 3 const 7 Using where
|
1 SIMPLE City ref Country,CountryPopulation Country 3 const 7 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
||||||
@ -708,7 +708,7 @@ SELECT * FROM City
|
|||||||
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
|
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
|
||||||
AND Country='FIN';
|
AND Country='FIN';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Population,Country,Name,CountryPopulation Country 3 const 7 Using where
|
1 SIMPLE City ref Population,Country,Name,CountryPopulation Country 3 const 7 Using index condition; Using where
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
|
||||||
AND Country='USA';
|
AND Country='USA';
|
||||||
@ -753,51 +753,51 @@ CREATE INDEX CountryName ON City(Country,Name);
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='USA';
|
SELECT * FROM City WHERE Country='USA';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 274 Using where
|
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 274 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='FIN';
|
SELECT * FROM City WHERE Country='FIN';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 7 Using where
|
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 7 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Country='BRA';
|
SELECT * FROM City WHERE Country='BRA';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 250 Using where
|
1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 250 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035;
|
SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032;
|
SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800;
|
SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 300 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 300 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300;
|
SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE ID BETWEEN 250 and 260 ;
|
SELECT * FROM City WHERE ID BETWEEN 250 and 260 ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where
|
1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 102000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 102000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 38 Using where
|
1 SIMPLE City range Population Population 4 NULL 38 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Population Population 4 NULL 80 Using where
|
1 SIMPLE City range Population Population 4 NULL 80 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City WHERE Name LIKE 'Pa%';
|
SELECT * FROM City WHERE Name LIKE 'Pa%';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range Name Name 35 NULL 71 Using where
|
1 SIMPLE City range Name Name 35 NULL 71 Using index condition
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 102000) OR
|
WHERE ((Population > 101000 AND Population < 102000) OR
|
||||||
@ -818,7 +818,7 @@ WHERE ((Population > 101000 AND Population < 110000) OR
|
|||||||
ID BETWEEN 3500 AND 3800) AND Country='FIN'
|
ID BETWEEN 3500 AND 3800) AND Country='FIN'
|
||||||
AND (Name BETWEEN 'P' AND 'T' OR ID BETWEEN 4000 AND 4300);
|
AND (Name BETWEEN 'P' AND 'T' OR ID BETWEEN 4000 AND 4300);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName Country 3 const 7 Using where
|
1 SIMPLE City ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName Country 3 const 7 Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE ((Population > 101000 AND Population < 102000) OR
|
WHERE ((Population > 101000 AND Population < 102000) OR
|
||||||
ID BETWEEN 3790 AND 3800) AND Country='USA'
|
ID BETWEEN 3790 AND 3800) AND Country='USA'
|
||||||
@ -950,14 +950,14 @@ WHERE ((Population > 101000 AND Population < 11000) OR
|
|||||||
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
||||||
AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300);
|
AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 38 NULL 18 Using where
|
1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 38 NULL 18 Using index condition; Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM City
|
SELECT * FROM City
|
||||||
WHERE ((Population > 101000 AND Population < 11000) OR
|
WHERE ((Population > 101000 AND Population < 11000) OR
|
||||||
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
||||||
AND (Name LIKE 'Pho%' OR ID BETWEEN 4000 AND 4300);
|
AND (Name LIKE 'Pho%' OR ID BETWEEN 4000 AND 4300);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 Using where
|
1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 Using index condition; Using where
|
||||||
SELECT * FROM City USE INDEX ()
|
SELECT * FROM City USE INDEX ()
|
||||||
WHERE ((Population > 101000 AND Population < 11000) OR
|
WHERE ((Population > 101000 AND Population < 11000) OR
|
||||||
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
ID BETWEEN 3500 AND 3800) AND Country='USA'
|
||||||
@ -1415,5 +1415,31 @@ a b c d
|
|||||||
0 75 5 3
|
0 75 5 3
|
||||||
SET SESSION optimizer_switch=DEFAULT;
|
SET SESSION optimizer_switch=DEFAULT;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a int NOT NULL PRIMARY KEY, b int, c int, INDEX idx(c,b));
|
||||||
|
INSERT INTO t1 VALUES (19,1,NULL), (20,5,7);
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||||
|
(t1.c=0 OR t1.a=500);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range PRIMARY,idx PRIMARY 4 NULL 1 Using index condition; Using where
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||||
|
(t1.c=0 OR t1.a=500);
|
||||||
|
a b c
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX idx(b));
|
||||||
|
INSERT INTO t1 VALUES (167,9999), (168,10000);
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 index PRIMARY,idx idx 5 NULL 2 Using where; Using index
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||||
|
a b
|
||||||
|
167 9999
|
||||||
|
168 10000
|
||||||
|
DROP TABLE t1;
|
||||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||||
|
@ -3419,7 +3419,7 @@ SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
|
|||||||
FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
|
FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
||||||
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
|
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
|
||||||
@ -3457,7 +3457,7 @@ In next EXPLAIN, B.rows must be exactly 10:
|
|||||||
explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
|
explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
|
||||||
and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
|
and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using where
|
1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where
|
||||||
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
|
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
|
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
|
||||||
@ -3471,12 +3471,12 @@ INSERT INTO t2 VALUES
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
|
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
|
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition
|
||||||
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
|
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
|
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where
|
||||||
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
@ -3566,19 +3566,19 @@ EXPLAIN SELECT t2.*
|
|||||||
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
||||||
WHERE t2.fk < 'c' AND t2.pk=t1.fk;
|
WHERE t2.fk < 'c' AND t2.pk=t1.fk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 3 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 3 Using index condition; Using where
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
||||||
EXPLAIN SELECT t2.*
|
EXPLAIN SELECT t2.*
|
||||||
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
||||||
WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk;
|
WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
||||||
EXPLAIN SELECT t2.*
|
EXPLAIN SELECT t2.*
|
||||||
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
||||||
WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk;
|
WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a));
|
CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a));
|
||||||
@ -3612,7 +3612,7 @@ WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
|
|||||||
t3.a=t2.a AND t3.c IN ('bb','ee');
|
t3.a=t2.a AND t3.c IN ('bb','ee');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si si 5 NULL 4 Using where
|
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t3.a FROM t1,t2,t3
|
SELECT t3.a FROM t1,t2,t3
|
||||||
@ -3620,7 +3620,7 @@ WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
|
|||||||
t3.a=t2.a AND t3.c IN ('bb','ee') ;
|
t3.a=t2.a AND t3.c IN ('bb','ee') ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si,ai si 5 NULL 4 Using where
|
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
|
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
|
||||||
@ -3628,7 +3628,7 @@ WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
|||||||
t3.c IN ('bb','ee');
|
t3.c IN ('bb','ee');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si si 5 NULL 2 Using where
|
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t3.a FROM t1,t2,t3
|
SELECT t3.a FROM t1,t2,t3
|
||||||
@ -3636,7 +3636,7 @@ WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
|||||||
t3.c IN ('bb','ee');
|
t3.c IN ('bb','ee');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si,ai si 5 NULL 2 Using where
|
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
|
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
|
||||||
@ -3756,7 +3756,7 @@ AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
|||||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t1 range ts ts 4 NULL 1 Using where
|
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||||
@ -4382,12 +4382,12 @@ CREATE TABLE t1 (a INT KEY, b INT);
|
|||||||
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
|
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
|
||||||
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
|
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
||||||
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
|
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -3419,7 +3419,7 @@ SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
|
|||||||
FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
|
FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
||||||
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
|
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
|
||||||
@ -3457,7 +3457,7 @@ In next EXPLAIN, B.rows must be exactly 10:
|
|||||||
explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
|
explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
|
||||||
and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
|
and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using where
|
1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where
|
||||||
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
|
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
|
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
|
||||||
@ -3471,12 +3471,12 @@ INSERT INTO t2 VALUES
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
|
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
|
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition
|
||||||
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
|
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
|
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using index condition; Using where
|
||||||
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
1 SIMPLE t2 ref c c 5 test.t1.a 2
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
@ -3566,19 +3566,19 @@ EXPLAIN SELECT t2.*
|
|||||||
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
||||||
WHERE t2.fk < 'c' AND t2.pk=t1.fk;
|
WHERE t2.fk < 'c' AND t2.pk=t1.fk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 3 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 3 Using index condition; Using where
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
||||||
EXPLAIN SELECT t2.*
|
EXPLAIN SELECT t2.*
|
||||||
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
||||||
WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk;
|
WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
||||||
EXPLAIN SELECT t2.*
|
EXPLAIN SELECT t2.*
|
||||||
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
FROM t1 JOIN t2 ON t2.fk=t1.pk
|
||||||
WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk;
|
WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a));
|
CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a));
|
||||||
@ -3612,7 +3612,7 @@ WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
|
|||||||
t3.a=t2.a AND t3.c IN ('bb','ee');
|
t3.a=t2.a AND t3.c IN ('bb','ee');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si si 5 NULL 4 Using where
|
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t3.a FROM t1,t2,t3
|
SELECT t3.a FROM t1,t2,t3
|
||||||
@ -3620,7 +3620,7 @@ WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
|
|||||||
t3.a=t2.a AND t3.c IN ('bb','ee') ;
|
t3.a=t2.a AND t3.c IN ('bb','ee') ;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si,ai si 5 NULL 4 Using where
|
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
|
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
|
||||||
@ -3628,7 +3628,7 @@ WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
|||||||
t3.c IN ('bb','ee');
|
t3.c IN ('bb','ee');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si si 5 NULL 2 Using where
|
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t3.a FROM t1,t2,t3
|
SELECT t3.a FROM t1,t2,t3
|
||||||
@ -3636,7 +3636,7 @@ WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
|||||||
t3.c IN ('bb','ee');
|
t3.c IN ('bb','ee');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t2 range si,ai si 5 NULL 2 Using where
|
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
|
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
|
||||||
@ -3756,7 +3756,7 @@ AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
|||||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t1 range ts ts 4 NULL 1 Using where
|
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||||
@ -4382,12 +4382,12 @@ CREATE TABLE t1 (a INT KEY, b INT);
|
|||||||
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
|
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
|
||||||
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
|
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
||||||
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
|
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -2969,9 +2969,10 @@ Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cac
|
|||||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func,func 1 100.00
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`two` = `test`.`t1`.`two`) and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`flag` = 'N'))
|
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N'))
|
||||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
@ -3558,7 +3559,8 @@ EXPLAIN
|
|||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
ALTER TABLE t1 ADD INDEX(a);
|
ALTER TABLE t1 ADD INDEX(a);
|
||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
a b
|
a b
|
||||||
@ -3568,8 +3570,9 @@ AAA 8
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL a NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 1
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1( f1 int,f2 int);
|
create table t1( f1 int,f2 int);
|
||||||
insert into t1 values (1,1),(2,2);
|
insert into t1 values (1,1),(2,2);
|
||||||
@ -4512,15 +4515,17 @@ INSERT INTO t1 VALUES (1),(2);
|
|||||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(1)))))
|
Note 1003 select 1 AS `1` from <materialize> (select 1 from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`1` = 1)
|
||||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(1)))))
|
Note 1003 select 1 AS `1` from <materialize> (select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`1` = 1)
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug#45061: Incorrectly market field caused wrong result.
|
# Bug#45061: Incorrectly market field caused wrong result.
|
||||||
@ -5548,10 +5553,11 @@ explain SELECT * FROM ot1,ot4
|
|||||||
WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a
|
WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a
|
||||||
FROM it2,it3);
|
FROM it2,it3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 Start temporary
|
1 PRIMARY ot1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY it2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 24 Using where
|
||||||
1 PRIMARY it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
|
1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; End temporary; Using join buffer (flat, BNL join)
|
2 SUBQUERY it2 ALL NULL NULL NULL NULL 4
|
||||||
|
2 SUBQUERY it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
|
||||||
DROP TABLE IF EXISTS ot1, ot4, it2, it3;
|
DROP TABLE IF EXISTS ot1, ot4, it2, it3;
|
||||||
#
|
#
|
||||||
# Bug#729039: NULL keys used to evaluate subquery
|
# Bug#729039: NULL keys used to evaluate subquery
|
||||||
@ -6016,4 +6022,14 @@ ERROR 21000: Subquery returns more than 1 row
|
|||||||
SET SESSION sql_mode=@old_sql_mode;
|
SET SESSION sql_mode=@old_sql_mode;
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# LP BUG#833777 Performance regression with deeply nested subqueries
|
||||||
|
#
|
||||||
|
create table t1 (a int not null, b char(10) not null);
|
||||||
|
insert into t1 values (1, 'a');
|
||||||
|
set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
|
||||||
|
select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
|
||||||
|
a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
set optimizer_switch=@subselect_tmp;
|
set optimizer_switch=@subselect_tmp;
|
||||||
|
@ -975,7 +975,7 @@ i1 i2
|
|||||||
# Baseline:
|
# Baseline:
|
||||||
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_rnd_next 17
|
Handler_read_rnd_next 18
|
||||||
|
|
||||||
INSERT INTO t1 VALUES (NULL, NULL);
|
INSERT INTO t1 VALUES (NULL, NULL);
|
||||||
FLUSH STATUS;
|
FLUSH STATUS;
|
||||||
@ -992,7 +992,7 @@ i1 i2
|
|||||||
# (read record from t1, but do not read from t2)
|
# (read record from t1, but do not read from t2)
|
||||||
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_rnd_next 18
|
Handler_read_rnd_next 19
|
||||||
set @@optimizer_switch=@save_optimizer_switch2;
|
set @@optimizer_switch=@save_optimizer_switch2;
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
@ -1023,6 +1023,8 @@ create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) orde
|
|||||||
create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
|
create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
|
||||||
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
|
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
|
||||||
create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
|
create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
||||||
explain select t21.* from t21,t22 where t21.a = t22.a and
|
explain select t21.* from t21,t22 where t21.a = t22.a and
|
||||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||||
@ -1035,10 +1037,11 @@ select t21.* from t21,t22 where t21.a = t22.a and
|
|||||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||||
a b c
|
a b c
|
||||||
256 67 NULL
|
256 67 NULL
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t1, t11, t12, t21, t22;
|
drop table t1, t11, t12, t21, t22;
|
||||||
create table t1(a int);
|
create table t1(a int);
|
||||||
insert into t1 values (0),(1);
|
insert into t1 values (0),(1);
|
||||||
set @@optimizer_switch='firstmatch=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
explain
|
explain
|
||||||
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
@ -1112,6 +1115,8 @@ a
|
|||||||
18
|
18
|
||||||
19
|
19
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
explain select * from (select a from t0) X where a in (select a from t1);
|
explain select * from (select a from t0) X where a in (select a from t1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11
|
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11
|
||||||
@ -1134,10 +1139,11 @@ insert into t4 select a from t3;
|
|||||||
explain select * from t3 where a in (select t1.kp1 from t1,t4 where kp1<20
|
explain select * from t3 where a in (select t1.kp1 from t1,t4 where kp1<20
|
||||||
and t4.pk=t1.c);
|
and t4.pk=t1.c);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 range kp1 kp1 5 NULL 48 Using where; LooseScan
|
1 PRIMARY t1 range kp1 kp1 5 NULL 48 Using index condition; Using where; LooseScan
|
||||||
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t1)
|
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t1)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
||||||
drop table t1, t3, t4;
|
drop table t1, t3, t4;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
create table t1 (a int) as select * from t0 where a < 5;
|
create table t1 (a int) as select * from t0 where a < 5;
|
||||||
set @save_max_heap_table_size=@@max_heap_table_size;
|
set @save_max_heap_table_size=@@max_heap_table_size;
|
||||||
set @@optimizer_switch='firstmatch=off,materialization=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
@ -1167,8 +1173,9 @@ create table t3 ( a int , filler char(100), key(a));
|
|||||||
insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B;
|
insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B;
|
||||||
explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10);
|
explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2
|
||||||
1 PRIMARY t3 ref a a 5 test.t2.a 1 End temporary
|
1 PRIMARY t3 ref a a 5 test.t2.a 1
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
select * from t3 where a in (select a from t2);
|
select * from t3 where a in (select a from t2);
|
||||||
a filler
|
a filler
|
||||||
1 filler
|
1 filler
|
||||||
@ -1207,6 +1214,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join)
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join)
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
create table t2 as select * from t1;
|
create table t2 as select * from t1;
|
||||||
@ -1267,11 +1276,12 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY t1 range a a 5 NULL 8 Using where; Using index; LooseScan
|
1 PRIMARY t1 range a a 5 NULL 8 Using where; Using index; LooseScan
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
create table t1 (a int, b int);
|
create table t1 (a int, b int);
|
||||||
insert into t1 select a,a from t0;
|
insert into t1 select a,a from t0;
|
||||||
create table t2 (a int, b int);
|
create table t2 (a int, b int);
|
||||||
insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B;
|
insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B;
|
||||||
set @@optimizer_switch='firstmatch=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
explain select * from t1 where (a,b) in (select a,b from t2);
|
explain select * from t1 where (a,b) in (select a,b from t2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Start temporary
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Start temporary
|
||||||
@ -1287,6 +1297,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
set @@optimizer_search_depth=@save_optimizer_search_depth;
|
set @@optimizer_search_depth=@save_optimizer_search_depth;
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t0, t1, t2;
|
drop table t0, t1, t2;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
create table t0 (a decimal(4,2));
|
create table t0 (a decimal(4,2));
|
||||||
insert into t0 values (10.24), (22.11);
|
insert into t0 values (10.24), (22.11);
|
||||||
create table t1 as select * from t0;
|
create table t1 as select * from t0;
|
||||||
@ -1325,6 +1336,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY Y ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY Y ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY Z ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (flat, BNL join)
|
1 PRIMARY Z ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (flat, BNL join)
|
||||||
drop table t0,t1,t2;
|
drop table t0,t1,t2;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
|
BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
|
||||||
|
|
||||||
@ -1386,6 +1398,8 @@ postalStripped varchar(100)
|
|||||||
);
|
);
|
||||||
insert into t3 values (1,1, 'foo'), (2,2,'bar');
|
insert into t3 values (1,1, 'foo'), (2,2,'bar');
|
||||||
The following must be converted to a semi-join:
|
The following must be converted to a semi-join:
|
||||||
|
set @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
explain extended SELECT a.idIndividual FROM t1 a
|
explain extended SELECT a.idIndividual FROM t1 a
|
||||||
WHERE a.idIndividual IN
|
WHERE a.idIndividual IN
|
||||||
( SELECT c.idObj FROM t3 cona
|
( SELECT c.idObj FROM t3 cona
|
||||||
@ -1398,6 +1412,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
|
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2'))
|
Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2'))
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
#
|
#
|
||||||
# BUG#47367 Crash in Name_resolution_context::process_error
|
# BUG#47367 Crash in Name_resolution_context::process_error
|
||||||
|
@ -984,7 +984,7 @@ i1 i2
|
|||||||
# Baseline:
|
# Baseline:
|
||||||
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_rnd_next 17
|
Handler_read_rnd_next 18
|
||||||
|
|
||||||
INSERT INTO t1 VALUES (NULL, NULL);
|
INSERT INTO t1 VALUES (NULL, NULL);
|
||||||
FLUSH STATUS;
|
FLUSH STATUS;
|
||||||
@ -1001,7 +1001,7 @@ i1 i2
|
|||||||
# (read record from t1, but do not read from t2)
|
# (read record from t1, but do not read from t2)
|
||||||
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
SHOW STATUS LIKE '%Handler_read_rnd_next';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_rnd_next 18
|
Handler_read_rnd_next 19
|
||||||
set @@optimizer_switch=@save_optimizer_switch2;
|
set @@optimizer_switch=@save_optimizer_switch2;
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
@ -1032,6 +1032,8 @@ create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) orde
|
|||||||
create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
|
create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
|
||||||
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
|
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
|
||||||
create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
|
create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
||||||
explain select t21.* from t21,t22 where t21.a = t22.a and
|
explain select t21.* from t21,t22 where t21.a = t22.a and
|
||||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||||
@ -1044,10 +1046,11 @@ select t21.* from t21,t22 where t21.a = t22.a and
|
|||||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||||
a b c
|
a b c
|
||||||
256 67 NULL
|
256 67 NULL
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t1, t11, t12, t21, t22;
|
drop table t1, t11, t12, t21, t22;
|
||||||
create table t1(a int);
|
create table t1(a int);
|
||||||
insert into t1 values (0),(1);
|
insert into t1 values (0),(1);
|
||||||
set @@optimizer_switch='firstmatch=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
explain
|
explain
|
||||||
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
@ -1121,6 +1124,8 @@ a
|
|||||||
18
|
18
|
||||||
19
|
19
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
explain select * from (select a from t0) X where a in (select a from t1);
|
explain select * from (select a from t0) X where a in (select a from t1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11
|
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11
|
||||||
@ -1147,6 +1152,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t1)
|
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t1)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
||||||
drop table t1, t3, t4;
|
drop table t1, t3, t4;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
create table t1 (a int) as select * from t0 where a < 5;
|
create table t1 (a int) as select * from t0 where a < 5;
|
||||||
set @save_max_heap_table_size=@@max_heap_table_size;
|
set @save_max_heap_table_size=@@max_heap_table_size;
|
||||||
set @@optimizer_switch='firstmatch=off,materialization=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
@ -1176,8 +1182,9 @@ create table t3 ( a int , filler char(100), key(a));
|
|||||||
insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B;
|
insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B;
|
||||||
explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10);
|
explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2
|
||||||
1 PRIMARY t3 ref a a 5 test.t2.a 1 End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
1 PRIMARY t3 ref a a 5 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
select * from t3 where a in (select a from t2);
|
select * from t3 where a in (select a from t2);
|
||||||
a filler
|
a filler
|
||||||
1 filler
|
1 filler
|
||||||
@ -1216,6 +1223,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY t1 hash_ALL NULL #hash#$hj 6 test.t1.a 2 Using where; End temporary; Using join buffer (flat, BNLH join)
|
1 PRIMARY t1 hash_ALL NULL #hash#$hj 6 test.t1.a 2 Using where; End temporary; Using join buffer (flat, BNLH join)
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
create table t2 as select * from t1;
|
create table t2 as select * from t1;
|
||||||
@ -1276,11 +1285,12 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY t1 range a a 5 NULL 8 Using where; Using index; LooseScan
|
1 PRIMARY t1 range a a 5 NULL 8 Using where; Using index; LooseScan
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
create table t1 (a int, b int);
|
create table t1 (a int, b int);
|
||||||
insert into t1 select a,a from t0;
|
insert into t1 select a,a from t0;
|
||||||
create table t2 (a int, b int);
|
create table t2 (a int, b int);
|
||||||
insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B;
|
insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B;
|
||||||
set @@optimizer_switch='firstmatch=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
explain select * from t1 where (a,b) in (select a,b from t2);
|
explain select * from t1 where (a,b) in (select a,b from t2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; Start temporary
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; Start temporary
|
||||||
@ -1296,6 +1306,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
set @@optimizer_search_depth=@save_optimizer_search_depth;
|
set @@optimizer_search_depth=@save_optimizer_search_depth;
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t0, t1, t2;
|
drop table t0, t1, t2;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
create table t0 (a decimal(4,2));
|
create table t0 (a decimal(4,2));
|
||||||
insert into t0 values (10.24), (22.11);
|
insert into t0 values (10.24), (22.11);
|
||||||
create table t1 as select * from t0;
|
create table t1 as select * from t0;
|
||||||
@ -1334,6 +1345,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY Y hash_ALL NULL #hash#$hj 5 test.t1.b 6 Using where; Using join buffer (incremental, BNLH join)
|
1 PRIMARY Y hash_ALL NULL #hash#$hj 5 test.t1.b 6 Using where; Using join buffer (incremental, BNLH join)
|
||||||
1 PRIMARY Z hash_ALL NULL #hash#$hj 5 test.t1.c 6 Using where; End temporary; Using join buffer (incremental, BNLH join)
|
1 PRIMARY Z hash_ALL NULL #hash#$hj 5 test.t1.c 6 Using where; End temporary; Using join buffer (incremental, BNLH join)
|
||||||
drop table t0,t1,t2;
|
drop table t0,t1,t2;
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
|
BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
|
||||||
|
|
||||||
@ -1395,6 +1407,8 @@ postalStripped varchar(100)
|
|||||||
);
|
);
|
||||||
insert into t3 values (1,1, 'foo'), (2,2,'bar');
|
insert into t3 values (1,1, 'foo'), (2,2,'bar');
|
||||||
The following must be converted to a semi-join:
|
The following must be converted to a semi-join:
|
||||||
|
set @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
explain extended SELECT a.idIndividual FROM t1 a
|
explain extended SELECT a.idIndividual FROM t1 a
|
||||||
WHERE a.idIndividual IN
|
WHERE a.idIndividual IN
|
||||||
( SELECT c.idObj FROM t3 cona
|
( SELECT c.idObj FROM t3 cona
|
||||||
@ -1407,6 +1421,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
|
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2'))
|
Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2'))
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
#
|
#
|
||||||
# BUG#47367 Crash in Name_resolution_context::process_error
|
# BUG#47367 Crash in Name_resolution_context::process_error
|
||||||
|
@ -119,6 +119,8 @@ CREATE TABLE t4 ( a INT );
|
|||||||
INSERT INTO t4 VALUES (1), (2), (3);
|
INSERT INTO t4 VALUES (1), (2), (3);
|
||||||
CREATE TABLE t5 ( a INT );
|
CREATE TABLE t5 ( a INT );
|
||||||
INSERT INTO t5 VALUES (NULL), (2);
|
INSERT INTO t5 VALUES (NULL), (2);
|
||||||
|
SET @old_optimizer_switch = @@session.optimizer_switch;
|
||||||
|
SET SESSION optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
|
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
@ -190,6 +192,7 @@ SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 );
|
|||||||
a b
|
a b
|
||||||
1 NULL
|
1 NULL
|
||||||
2 NULL
|
2 NULL
|
||||||
|
SET SESSION optimizer_switch = @old_optimizer_switch;
|
||||||
DROP TABLE t1, t2, t3, t4, t5;
|
DROP TABLE t1, t2, t3, t4, t5;
|
||||||
#
|
#
|
||||||
# Bug#58207: invalid memory reads when using default column value and
|
# Bug#58207: invalid memory reads when using default column value and
|
||||||
@ -1092,17 +1095,19 @@ EXPLAIN
|
|||||||
SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
||||||
c1 c1 c1
|
c1 c1 c1
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
1 PRIMARY t4 index NULL PRIMARY 3 NULL 2 Using index; Using join buffer (flat, BNL join)
|
1 PRIMARY t4 index NULL PRIMARY 3 NULL 2 Using index; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
|
||||||
c1 c1
|
c1 c1
|
||||||
drop table t1, t2, t3, t4;
|
drop table t1, t2, t3, t4;
|
||||||
|
@ -1356,12 +1356,12 @@ Subquery_cache_miss 0
|
|||||||
show status like '%Handler_read%';
|
show status like '%Handler_read%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_first 0
|
Handler_read_first 0
|
||||||
Handler_read_key 0
|
Handler_read_key 11
|
||||||
Handler_read_last 0
|
Handler_read_last 0
|
||||||
Handler_read_next 0
|
Handler_read_next 0
|
||||||
Handler_read_prev 0
|
Handler_read_prev 0
|
||||||
Handler_read_rnd 0
|
Handler_read_rnd 0
|
||||||
Handler_read_rnd_next 188
|
Handler_read_rnd_next 145
|
||||||
set optimizer_switch='subquery_cache=on';
|
set optimizer_switch='subquery_cache=on';
|
||||||
flush status;
|
flush status;
|
||||||
select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
|
select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
|
||||||
@ -1385,12 +1385,12 @@ Subquery_cache_miss 18
|
|||||||
show status like '%Handler_read%';
|
show status like '%Handler_read%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_read_first 0
|
Handler_read_first 0
|
||||||
Handler_read_key 27
|
Handler_read_key 32
|
||||||
Handler_read_last 0
|
Handler_read_last 0
|
||||||
Handler_read_next 0
|
Handler_read_next 0
|
||||||
Handler_read_prev 0
|
Handler_read_prev 0
|
||||||
Handler_read_rnd 0
|
Handler_read_rnd 0
|
||||||
Handler_read_rnd_next 102
|
Handler_read_rnd_next 84
|
||||||
#several subqueries (several levels)
|
#several subqueries (several levels)
|
||||||
set optimizer_switch='subquery_cache=off';
|
set optimizer_switch='subquery_cache=off';
|
||||||
flush status;
|
flush status;
|
||||||
|
@ -307,7 +307,8 @@ EXPLAIN SELECT 1 FROM t1 WHERE a IN
|
|||||||
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index
|
1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 144 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 144
|
||||||
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
||||||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
||||||
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
||||||
|
@ -311,7 +311,7 @@ EXPLAIN SELECT 1 FROM t1 WHERE a IN
|
|||||||
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 144 Using where; Using index
|
1 PRIMARY t1 index NULL PRIMARY 4 NULL 144 Using where; Using index
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 144 Using where
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 144
|
||||||
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
||||||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
||||||
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
||||||
@ -324,7 +324,7 @@ EXPLAIN SELECT 1 FROM t2 WHERE a IN
|
|||||||
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
|
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 144 Using where
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 144
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
#
|
#
|
||||||
# From derived_view.test
|
# From derived_view.test
|
||||||
@ -349,9 +349,9 @@ WHERE t.a IN (SELECT b FROM t1);
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
3 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
|
3 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(select 0 from dual where (<cache>(0) = 0))))
|
Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,0 in ( <materialize> (select 0 from dual ), <primary_index_lookup>(0 in <temporary table> on distinct_key where ((0 = `<subquery3>`.`b`))))))
|
||||||
SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
|
SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
|
||||||
WHERE t.a IN (SELECT b FROM t1);
|
WHERE t.a IN (SELECT b FROM t1);
|
||||||
a a b
|
a a b
|
||||||
@ -362,9 +362,9 @@ WHERE t.a IN (SELECT b FROM t1);
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
|
2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(select 0 from dual where (<cache>(0) = 0))))
|
Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,0 in ( <materialize> (select 0 from dual ), <primary_index_lookup>(0 in <temporary table> on distinct_key where ((0 = `<subquery2>`.`b`))))))
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
#
|
#
|
||||||
|
@ -1847,7 +1847,7 @@ EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 Using where
|
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition
|
||||||
SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
|
SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
|
||||||
pk
|
pk
|
||||||
2
|
2
|
||||||
|
@ -301,7 +301,7 @@ insert into t2 values (0,0,0,'filler'),(0,1,1,'filler'),(0,2,2,'filler'),(0,3,3,
|
|||||||
create index key1 on t2 (kp1, kp2);
|
create index key1 on t2 (kp1, kp2);
|
||||||
create index key2 on t2 (kp1);
|
create index key2 on t2 (kp1);
|
||||||
create index key3 on t2 (kp2);
|
create index key3 on t2 (kp2);
|
||||||
set session optimizer_switch='default';
|
SET @@optimizer_switch='materialization=off,semijoin=off,in_to_exists=on';
|
||||||
analyze table t2;
|
analyze table t2;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t2 analyze status OK
|
test.t2 analyze status OK
|
||||||
@ -312,6 +312,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
2 DEPENDENT SUBQUERY t2 index_subquery key1,key2,key3 key1 10 func,const 1 Using where
|
2 DEPENDENT SUBQUERY t2 index_subquery key1,key2,key3 key1 10 func,const 1 Using where
|
||||||
select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
|
select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
|
||||||
c1
|
c1
|
||||||
|
set @@optimizer_switch='default';
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
#
|
#
|
||||||
# LP BUG#800679: Assertion `outer_join->table_count > 0' failed in
|
# LP BUG#800679: Assertion `outer_join->table_count > 0' failed in
|
||||||
@ -355,8 +356,8 @@ WHERE t4.a >= t3.b
|
|||||||
AND a = SOME (SELECT b FROM t5));
|
AND a = SOME (SELECT b FROM t5));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
|
||||||
2 DEPENDENT SUBQUERY t5 index c c 10 NULL 2 Using where; Using index; LooseScan
|
2 DEPENDENT SUBQUERY t5 index c c 10 NULL 2 Using where; Using index; Start temporary
|
||||||
2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t5.b 1 Using where
|
2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t5.b 1 Using index condition; Using where; End temporary
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t3
|
FROM t3
|
||||||
WHERE t3.b > ALL (
|
WHERE t3.b > ALL (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
select @@optimizer_switch like '%materialization=on%';
|
select @@optimizer_switch like '%materialization=on%';
|
||||||
@@optimizer_switch like '%materialization=on%'
|
@@optimizer_switch like '%materialization=on%'
|
||||||
0
|
1
|
||||||
set optimizer_switch='materialization=off';
|
set optimizer_switch='materialization=off';
|
||||||
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
|
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
|
||||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
|
||||||
@ -6021,8 +6021,18 @@ ERROR 21000: Subquery returns more than 1 row
|
|||||||
SET SESSION sql_mode=@old_sql_mode;
|
SET SESSION sql_mode=@old_sql_mode;
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# LP BUG#833777 Performance regression with deeply nested subqueries
|
||||||
|
#
|
||||||
|
create table t1 (a int not null, b char(10) not null);
|
||||||
|
insert into t1 values (1, 'a');
|
||||||
|
set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
|
||||||
|
select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
|
||||||
|
a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
set optimizer_switch=@subselect_tmp;
|
set optimizer_switch=@subselect_tmp;
|
||||||
set optimizer_switch=default;
|
set optimizer_switch=default;
|
||||||
select @@optimizer_switch like '%materialization=on%';
|
select @@optimizer_switch like '%materialization=on%';
|
||||||
@@optimizer_switch like '%materialization=on%'
|
@@optimizer_switch like '%materialization=on%'
|
||||||
0
|
1
|
||||||
|
@ -6017,5 +6017,15 @@ ERROR 21000: Subquery returns more than 1 row
|
|||||||
SET SESSION sql_mode=@old_sql_mode;
|
SET SESSION sql_mode=@old_sql_mode;
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# LP BUG#833777 Performance regression with deeply nested subqueries
|
||||||
|
#
|
||||||
|
create table t1 (a int not null, b char(10) not null);
|
||||||
|
insert into t1 values (1, 'a');
|
||||||
|
set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
|
||||||
|
select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
|
||||||
|
a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
set optimizer_switch=@subselect_tmp;
|
set optimizer_switch=@subselect_tmp;
|
||||||
set @optimizer_switch_for_subselect_test=null;
|
set @optimizer_switch_for_subselect_test=null;
|
||||||
|
@ -2973,9 +2973,10 @@ Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optim
|
|||||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func,func 1 100.00
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`two` = `test`.`t1`.`two`) and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`flag` = 'N'))
|
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N'))
|
||||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
@ -3562,7 +3563,8 @@ EXPLAIN
|
|||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
ALTER TABLE t1 ADD INDEX(a);
|
ALTER TABLE t1 ADD INDEX(a);
|
||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
a b
|
a b
|
||||||
@ -3572,8 +3574,9 @@ AAA 8
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL a NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 1
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1( f1 int,f2 int);
|
create table t1( f1 int,f2 int);
|
||||||
insert into t1 values (1,1),(2,2);
|
insert into t1 values (1,1),(2,2);
|
||||||
@ -4516,15 +4519,17 @@ INSERT INTO t1 VALUES (1),(2);
|
|||||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(1))))
|
Note 1003 select 1 AS `1` from <materialize> (select 1 from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`1` = 1)
|
||||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(1))))
|
Note 1003 select 1 AS `1` from <materialize> (select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`1` = 1)
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug#45061: Incorrectly market field caused wrong result.
|
# Bug#45061: Incorrectly market field caused wrong result.
|
||||||
@ -5552,10 +5557,11 @@ explain SELECT * FROM ot1,ot4
|
|||||||
WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a
|
WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a
|
||||||
FROM it2,it3);
|
FROM it2,it3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 Start temporary
|
1 PRIMARY ot1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY it2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 24 Using where
|
||||||
1 PRIMARY it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
|
1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; End temporary; Using join buffer (flat, BNL join)
|
2 SUBQUERY it2 ALL NULL NULL NULL NULL 4
|
||||||
|
2 SUBQUERY it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
|
||||||
DROP TABLE IF EXISTS ot1, ot4, it2, it3;
|
DROP TABLE IF EXISTS ot1, ot4, it2, it3;
|
||||||
#
|
#
|
||||||
# Bug#729039: NULL keys used to evaluate subquery
|
# Bug#729039: NULL keys used to evaluate subquery
|
||||||
@ -6020,6 +6026,16 @@ ERROR 21000: Subquery returns more than 1 row
|
|||||||
SET SESSION sql_mode=@old_sql_mode;
|
SET SESSION sql_mode=@old_sql_mode;
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# LP BUG#833777 Performance regression with deeply nested subqueries
|
||||||
|
#
|
||||||
|
create table t1 (a int not null, b char(10) not null);
|
||||||
|
insert into t1 values (1, 'a');
|
||||||
|
set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
|
||||||
|
select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
|
||||||
|
a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
set optimizer_switch=@subselect_tmp;
|
set optimizer_switch=@subselect_tmp;
|
||||||
set optimizer_switch=default;
|
set optimizer_switch=default;
|
||||||
select @@optimizer_switch like '%subquery_cache=on%';
|
select @@optimizer_switch like '%subquery_cache=on%';
|
||||||
|
@ -904,9 +904,9 @@ a t1.a in (select t2.a from t2)
|
|||||||
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
|
explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
|
2 SUBQUERY t2 index a a 5 NULL 3 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`a`)))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
|
||||||
CREATE TABLE t3 (a int(11) default '0');
|
CREATE TABLE t3 (a int(11) default '0');
|
||||||
INSERT INTO t3 VALUES (1),(2),(3);
|
INSERT INTO t3 VALUES (1),(2),(3);
|
||||||
SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
|
SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
|
||||||
@ -918,10 +918,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a)
|
|||||||
explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
|
explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
|
2 SUBQUERY t2 index a a 5 NULL 3 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
|
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where (`test`.`t3`.`a` = `test`.`t2`.`a`) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`a`)))))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
# check correct NULL Processing for normal IN/ALL/ANY
|
# check correct NULL Processing for normal IN/ALL/ANY
|
||||||
# and 2 ways of max/min optimization
|
# and 2 ways of max/min optimization
|
||||||
@ -1434,9 +1434,9 @@ a
|
|||||||
explain extended select * from t2 where t2.a in (select a from t1);
|
explain extended select * from t2 where t2.a in (select a from t1);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
||||||
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
|
2 SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))))
|
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`))))))
|
||||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||||
a
|
a
|
||||||
2
|
2
|
||||||
@ -1444,9 +1444,9 @@ a
|
|||||||
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
||||||
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where
|
2 SUBQUERY t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))))
|
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`))))))
|
||||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||||
a
|
a
|
||||||
2
|
2
|
||||||
@ -1454,10 +1454,10 @@ a
|
|||||||
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
||||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where
|
2 SUBQUERY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
|
2 SUBQUERY t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
|
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`))))))
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
create table t1 (a int, b int, index a (a,b));
|
create table t1 (a int, b int, index a (a,b));
|
||||||
create table t2 (a int, index a (a));
|
create table t2 (a int, index a (a));
|
||||||
@ -1605,27 +1605,27 @@ a3 1
|
|||||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
|
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
2 SUBQUERY t2 index s1 s1 6 NULL 2 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
|
||||||
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
|
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
2 SUBQUERY t2 index s1 s1 6 NULL 2 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
|
||||||
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
|
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
|
2 SUBQUERY t2 index s1 s1 6 NULL 2 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
|
||||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
|
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
2 SUBQUERY t2 index s1 s1 6 NULL 2 50.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` where (`test`.`t2`.`s1` < 'a2') ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
create table t2 (a int, b int not null);
|
create table t2 (a int, b int not null);
|
||||||
create table t3 (a int);
|
create table t3 (a int);
|
||||||
@ -1878,9 +1878,9 @@ id text
|
|||||||
explain extended select * from t1 where id not in (select id from t1 where id < 8);
|
explain extended select * from t1 where id not in (select id from t1 where id < 8);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
|
2 SUBQUERY t1 range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))))))
|
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,`test`.`t1`.`id` in ( <materialize> (select `test`.`t1`.`id` from `test`.`t1` where (`test`.`t1`.`id` < 8) ), <primary_index_lookup>(`test`.`t1`.`id` in <temporary table> on distinct_key where ((`test`.`t1`.`id` = `<subquery2>`.`id`))))))))
|
||||||
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
|
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
|
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||||
@ -2964,21 +2964,21 @@ one two test
|
|||||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1;
|
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `<subquery2>`.`one`) and (`test`.`t1`.`two` = `<subquery2>`.`two`)))))) AS `test` from `test`.`t1`
|
||||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`)))))
|
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `<subquery2>`.`one`) and (`test`.`t1`.`two` = `<subquery2>`.`two`))))))
|
||||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
|
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `<subquery2>`.`one`) and (`test`.`t1`.`two` = `<subquery2>`.`two`)))))) AS `test` from `test`.`t1`
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
set optimizer_switch=@tmp11867_optimizer_switch;
|
set optimizer_switch=@tmp11867_optimizer_switch;
|
||||||
CREATE TABLE t1 (a char(5), b char(5));
|
CREATE TABLE t1 (a char(5), b char(5));
|
||||||
@ -3159,7 +3159,7 @@ INSERT INTO t2 VALUES (1),(2),(3);
|
|||||||
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 3
|
||||||
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
|
2 SUBQUERY t1 index a a 5 NULL 5 Using index
|
||||||
SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
SELECT a, a IN (SELECT a FROM t1) FROM t2;
|
||||||
a a IN (SELECT a FROM t1)
|
a a IN (SELECT a FROM t1)
|
||||||
1 1
|
1 1
|
||||||
@ -3559,7 +3559,7 @@ EXPLAIN
|
|||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
ALTER TABLE t1 ADD INDEX(a);
|
ALTER TABLE t1 ADD INDEX(a);
|
||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
a b
|
a b
|
||||||
@ -3570,7 +3570,7 @@ EXPLAIN
|
|||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 1
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1( f1 int,f2 int);
|
create table t1( f1 int,f2 int);
|
||||||
insert into t1 values (1,1),(2,2);
|
insert into t1 values (1,1),(2,2);
|
||||||
@ -4364,7 +4364,7 @@ CREATE INDEX I2 ON t1 (b);
|
|||||||
EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
|
EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where
|
2 SUBQUERY t1 index I1 I1 2 NULL 2 Using index
|
||||||
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
|
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
|
||||||
a b
|
a b
|
||||||
CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
|
CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
|
||||||
@ -4374,14 +4374,14 @@ CREATE INDEX I2 ON t2 (b);
|
|||||||
EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
|
EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 2 Using index; Using where
|
2 SUBQUERY t2 index I1 I1 4 NULL 2 Using index
|
||||||
SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
|
SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
|
||||||
a b
|
a b
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
|
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where
|
2 SUBQUERY t1 index I1 I1 2 NULL 2 Using where; Using index
|
||||||
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
|
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
|
||||||
a b
|
a b
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
@ -4513,15 +4513,15 @@ INSERT INTO t1 VALUES (1),(2);
|
|||||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having (1 = <ref_null_helper>(1)))))
|
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,1 in ( <materialize> (select 1 from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`1`))))))
|
||||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = <ref_null_helper>(1)))))
|
Note 1003 select 1 AS `1` from `test`.`t1` where <expr_cache><1>(<in_optimizer>(1,1 in ( <materialize> (select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery2>`.`1`))))))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# Bug#45061: Incorrectly market field caused wrong result.
|
# Bug#45061: Incorrectly market field caused wrong result.
|
||||||
@ -4587,7 +4587,7 @@ WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2)
|
|||||||
ORDER BY outr.pk;
|
ORDER BY outr.pk;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
x x outr ALL x x x x x x
|
x x outr ALL x x x x x x
|
||||||
x x t1 eq_ref x x x x x x
|
x x t1 index x x x x x x
|
||||||
x x t2 index x x x x x x
|
x x t2 index x x x x x x
|
||||||
# should not crash on debug binaries
|
# should not crash on debug binaries
|
||||||
SELECT * FROM t2 outr
|
SELECT * FROM t2 outr
|
||||||
@ -5551,8 +5551,8 @@ FROM it2,it3);
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY ot1 ALL NULL NULL NULL NULL 2
|
1 PRIMARY ot1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
2 DEPENDENT SUBQUERY it2 ALL NULL NULL NULL NULL 4 Using where
|
2 SUBQUERY it2 ALL NULL NULL NULL NULL 4
|
||||||
2 DEPENDENT SUBQUERY it3 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
|
2 SUBQUERY it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
|
||||||
DROP TABLE IF EXISTS ot1, ot4, it2, it3;
|
DROP TABLE IF EXISTS ot1, ot4, it2, it3;
|
||||||
#
|
#
|
||||||
# Bug#729039: NULL keys used to evaluate subquery
|
# Bug#729039: NULL keys used to evaluate subquery
|
||||||
@ -5596,8 +5596,8 @@ INSERT INTO t2 VALUES (15,4);
|
|||||||
EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
|
EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index
|
2 SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index
|
||||||
2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index
|
2 SUBQUERY it index PRIMARY PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
|
||||||
SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
|
SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
|
||||||
pk i
|
pk i
|
||||||
11 0
|
11 0
|
||||||
@ -5840,7 +5840,7 @@ WHERE (t2.b , t1.c) NOT IN (SELECT * from t3);
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
|
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2
|
||||||
SELECT t2.b , t1.c
|
SELECT t2.b , t1.c
|
||||||
FROM t2 LEFT JOIN t1 ON t1.c < 3
|
FROM t2 LEFT JOIN t1 ON t1.c < 3
|
||||||
WHERE (t2.b, t1.c) NOT IN (SELECT * from t3);
|
WHERE (t2.b, t1.c) NOT IN (SELECT * from t3);
|
||||||
@ -6017,5 +6017,15 @@ ERROR 21000: Subquery returns more than 1 row
|
|||||||
SET SESSION sql_mode=@old_sql_mode;
|
SET SESSION sql_mode=@old_sql_mode;
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# LP BUG#833777 Performance regression with deeply nested subqueries
|
||||||
|
#
|
||||||
|
create table t1 (a int not null, b char(10) not null);
|
||||||
|
insert into t1 values (1, 'a');
|
||||||
|
set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
|
||||||
|
select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
|
||||||
|
a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
set optimizer_switch=@subselect_tmp;
|
set optimizer_switch=@subselect_tmp;
|
||||||
set @optimizer_switch_for_subselect_test=null;
|
set @optimizer_switch_for_subselect_test=null;
|
||||||
|
@ -79,18 +79,18 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
|
|||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||||
1 PRIMARY A ALL NULL NULL NULL NULL 3 100.00 Using where
|
1 PRIMARY A ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where
|
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
2 DEPENDENT SUBQUERY t10 unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index
|
2 SUBQUERY t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,<exists>(<primAry_index_lookup>(<cAche>(`test`.`B`.`A`) in t10 on PRIMARY))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1
|
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1
|
||||||
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
|
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
|
||||||
explAin extended
|
explAin extended
|
||||||
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
|
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
|
||||||
id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
|
id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
2 DEPENDENT SUBQUERY t10 unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index
|
2 SUBQUERY t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,<exists>(<primAry_index_lookup>(<cAche>(`test`.`t2`.`A`) in t10 on PRIMARY))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1
|
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,`test`.`t2`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t2`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t2`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1
|
||||||
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
|
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
|
||||||
explain select * from
|
explain select * from
|
||||||
t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
|
t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
|
||||||
@ -724,9 +724,10 @@ SELECT int_key FROM ot1
|
|||||||
WHERE int_nokey IN (SELECT it2.int_key
|
WHERE int_nokey IN (SELECT it2.int_key
|
||||||
FROM it1 LEFT JOIN it2 ON it2.datetime_key);
|
FROM it1 LEFT JOIN it2 ON it2.datetime_key);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY it1 index NULL int_key 4 NULL 2 Using index; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 11
|
||||||
1 PRIMARY ot1 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
|
1 PRIMARY ot1 ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY it2 ALL int_key,datetime_key NULL NULL NULL 20 Using where; End temporary
|
2 SUBQUERY it1 index NULL int_key 4 NULL 2 Using index
|
||||||
|
2 SUBQUERY it2 ALL int_key,datetime_key NULL NULL NULL 20 Using where
|
||||||
DROP TABLE ot1, it1, it2;
|
DROP TABLE ot1, it1, it2;
|
||||||
# End of BUG#38075
|
# End of BUG#38075
|
||||||
#
|
#
|
||||||
@ -798,9 +799,10 @@ INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii','iiii','ffff','ffff','ffff','f
|
|||||||
EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 13 func,func 1 100.00
|
||||||
|
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Rowid-ordered scan
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`pk` > 0))
|
Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0))
|
||||||
SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
||||||
pk
|
pk
|
||||||
2
|
2
|
||||||
@ -966,9 +968,10 @@ FROM t1
|
|||||||
WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
|
WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00
|
||||||
1 PRIMARY t1 ref varchar_key varchar_key 3 test.t2.varchar_nokey 2 100.00 Using where; FirstMatch(t2)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
|
||||||
|
2 SUBQUERY t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_key` = `test`.`t2`.`varchar_nokey`) and (`test`.`t1`.`varchar_nokey` = `test`.`t2`.`varchar_nokey`) and ((`test`.`t2`.`varchar_nokey` < 'n') xor `test`.`t1`.`pk`))
|
Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_key` < 'n') xor `test`.`t1`.`pk`))
|
||||||
SELECT varchar_nokey
|
SELECT varchar_nokey
|
||||||
FROM t2
|
FROM t2
|
||||||
WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
|
WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
|
||||||
@ -1046,9 +1049,11 @@ WHERE t2.val LIKE 'a%' OR t2.val LIKE 'e%')
|
|||||||
AND t1.val IN (SELECT t3.val FROM t3
|
AND t1.val IN (SELECT t3.val FROM t3
|
||||||
WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%');
|
WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Start temporary
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 Using where
|
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 14 func 1
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 6 Using where; End temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 14 func 1
|
||||||
|
3 SUBQUERY t3 ALL NULL NULL NULL NULL 5 Using where
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t1
|
FROM t1
|
||||||
WHERE t1.val IN (SELECT t2.val FROM t2
|
WHERE t1.val IN (SELECT t2.val FROM t2
|
||||||
@ -1266,10 +1271,12 @@ explain
|
|||||||
select * from t1 A, t1 B
|
select * from t1 A, t1 B
|
||||||
where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D);
|
where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY A ALL NULL NULL NULL NULL 3 Start temporary
|
1 PRIMARY A ALL NULL NULL NULL NULL 3
|
||||||
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
1 PRIMARY B ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY B ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY C ALL NULL NULL NULL NULL 3 Using where
|
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 5 func 1
|
||||||
1 PRIMARY D ALL NULL NULL NULL NULL 3 Using where; End temporary
|
2 SUBQUERY C ALL NULL NULL NULL NULL 3
|
||||||
|
3 SUBQUERY D ALL NULL NULL NULL NULL 3
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
#
|
#
|
||||||
# BUG#784441: Abort on semijoin with a view as the inner table
|
# BUG#784441: Abort on semijoin with a view as the inner table
|
||||||
@ -1284,7 +1291,7 @@ SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||||
2 DEPENDENT SUBQUERY <derived3> system NULL NULL NULL NULL 1
|
2 SUBQUERY <derived3> system NULL NULL NULL NULL 1
|
||||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
||||||
a a
|
a a
|
||||||
@ -1387,9 +1394,10 @@ insert into t3 values('three'),( 'four');
|
|||||||
insert into t3 values('three'),( 'four');
|
insert into t3 values('three'),( 'four');
|
||||||
explain select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
explain select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where; End temporary; Using join buffer (flat, BNL join)
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
||||||
b
|
b
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
@ -2060,4 +2068,37 @@ a
|
|||||||
3
|
3
|
||||||
set optimizer_switch= @tmp_otimizer_switch;
|
set optimizer_switch= @tmp_otimizer_switch;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# Bug #887496: semijoin with IN equality for the second part of an index
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
INSERT INTO t1 VALUES (9), (0), (8), (5);
|
||||||
|
CREATE TABLE t2 (a int, b varchar(1), INDEX idx (b,a));
|
||||||
|
INSERT INTO t2 VALUES (5,'r'), (5,'z');
|
||||||
|
CREATE TABLE t3 (a int, b varchar(1), INDEX idx (b,a));
|
||||||
|
INSERT INTO t3 VALUES (5,'r'), (5,'z');
|
||||||
|
set @tmp_otimizer_switch= @@optimizer_switch;
|
||||||
|
SET SESSION optimizer_switch='semijoin=on,firstmatch=on';
|
||||||
|
SET SESSION optimizer_switch='loosescan=off';
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary
|
||||||
|
1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join)
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
a
|
||||||
|
5
|
||||||
|
SET SESSION optimizer_switch='loosescan=on';
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary
|
||||||
|
1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join)
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
a
|
||||||
|
5
|
||||||
|
set optimizer_switch= @tmp_otimizer_switch;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
|
@ -46,8 +46,9 @@ a b
|
|||||||
19 14
|
19 14
|
||||||
explain select * from t2 where b in (select a from t1);
|
explain select * from t2 where b in (select a from t1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
|
||||||
1 PRIMARY t2 ref b b 5 test.t1.a 2 End temporary
|
1 PRIMARY t2 ref b b 5 test.t1.a 2
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
select * from t2 where b in (select a from t1);
|
select * from t2 where b in (select a from t1);
|
||||||
a b
|
a b
|
||||||
1 1
|
1 1
|
||||||
@ -65,8 +66,9 @@ insert into t3 select a,a, a,a,a from t0;
|
|||||||
insert into t3 select a,a, a+100,a+100,a+100 from t0;
|
insert into t3 select a,a, a+100,a+100,a+100 from t0;
|
||||||
explain select * from t3 where b in (select a from t1);
|
explain select * from t3 where b in (select a from t1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Start temporary
|
1 PRIMARY t3 ALL b NULL NULL NULL 20
|
||||||
1 PRIMARY t3 ref b b 5 test.t1.a 1 End temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3
|
||||||
select * from t3 where b in (select a from t1);
|
select * from t3 where b in (select a from t1);
|
||||||
a b pk1 pk2 pk3
|
a b pk1 pk2 pk3
|
||||||
1 1 1 1 1
|
1 1 1 1 1
|
||||||
@ -90,8 +92,9 @@ A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a
|
|||||||
from t0 A, t0 B where B.a <5;
|
from t0 A, t0 B where B.a <5;
|
||||||
explain select * from t3 where b in (select a from t0);
|
explain select * from t3 where b in (select a from t0);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 10
|
||||||
1 PRIMARY t3 ref b b 5 test.t0.a 1 End temporary
|
1 PRIMARY t3 ref b b 5 test.t0.a 1
|
||||||
|
2 SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
|
||||||
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
|
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
|
||||||
a b pk1 pk2
|
a b pk1 pk2
|
||||||
0 0 0 0
|
0 0 0 0
|
||||||
@ -140,8 +143,9 @@ explain select
|
|||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 22 Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 22
|
||||||
1 PRIMARY ot ALL NULL NULL NULL NULL 32 Using where; End temporary; Using join buffer (flat, BNL join)
|
1 PRIMARY ot ALL NULL NULL NULL NULL 32 Using where; Using join buffer (flat, BNL join)
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 22
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
@ -173,7 +177,8 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 32 Using where; FirstMatch(ot)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 32
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
@ -206,8 +211,9 @@ explain select
|
|||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 22 Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 22
|
||||||
1 PRIMARY ot ALL NULL NULL NULL NULL 52 Using where; End temporary; Using join buffer (flat, BNL join)
|
1 PRIMARY ot ALL NULL NULL NULL NULL 52 Using where; Using join buffer (flat, BNL join)
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 22
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
@ -239,7 +245,8 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 52 Using where; FirstMatch(ot)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 52
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
@ -279,9 +286,10 @@ from t0 where a in
|
|||||||
(select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a);
|
(select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t0 ALL NULL NULL NULL NULL 10
|
1 PRIMARY t0 ALL NULL NULL NULL NULL 10
|
||||||
1 PRIMARY t1 index a a 5 NULL 10 Using where; Using index
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 9 func 1 Using where
|
||||||
1 PRIMARY t2 ref a a 5 test.t1.a 1 Using index
|
2 SUBQUERY t1 index a a 5 NULL 10 Using where; Using index
|
||||||
1 PRIMARY t3 ref a a 5 test.t1.a 1 Using index; FirstMatch(t0)
|
2 SUBQUERY t2 ref a a 5 test.t1.a 1 Using index
|
||||||
|
2 SUBQUERY t3 ref a a 5 test.t1.a 1 Using index
|
||||||
drop table t0, t1,t2,t3;
|
drop table t0, t1,t2,t3;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
ID int(11) NOT NULL auto_increment,
|
ID int(11) NOT NULL auto_increment,
|
||||||
@ -358,7 +366,8 @@ WHERE t1.Code IN (
|
|||||||
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31
|
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31
|
||||||
1 PRIMARY t2 ref CountryCode CountryCode 3 test.t1.Code 18 Using where; FirstMatch(t1)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1
|
||||||
|
2 SUBQUERY t2 ALL CountryCode NULL NULL NULL 545 Using where
|
||||||
SELECT Name FROM t1
|
SELECT Name FROM t1
|
||||||
WHERE t1.Code IN (
|
WHERE t1.Code IN (
|
||||||
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
||||||
@ -593,7 +602,7 @@ select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t3));
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using where
|
||||||
2 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
|
2 SUBQUERY t3 index PRIMARY PRIMARY 4 NULL 10 Using index
|
||||||
drop table t0, t1, t2, t3;
|
drop table t0, t1, t2, t3;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
@ -705,8 +714,9 @@ alter table t3 add primary key(id), add key(a);
|
|||||||
The following must use loose index scan over t3, key a:
|
The following must use loose index scan over t3, key a:
|
||||||
explain select count(a) from t2 where a in ( SELECT a FROM t3);
|
explain select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 index a a 5 NULL 1000 Using where; Using index
|
1 PRIMARY t2 index a a 5 NULL 1000 Using index
|
||||||
1 PRIMARY t3 ref a a 5 test.t2.a 30 Using index; FirstMatch(t2)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY t3 index a a 5 NULL 30000 Using index
|
||||||
select count(a) from t2 where a in ( SELECT a FROM t3);
|
select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||||
count(a)
|
count(a)
|
||||||
1000
|
1000
|
||||||
@ -861,10 +871,11 @@ EXPLAIN
|
|||||||
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
||||||
WHERE t3.b IN (SELECT b FROM t4);
|
WHERE t3.b IN (SELECT b FROM t4);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Start temporary
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 1
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where
|
||||||
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2
|
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where; End temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY t4 ALL NULL NULL NULL NULL 2
|
||||||
3 DERIVED t1 ALL NULL NULL NULL NULL 1
|
3 DERIVED t1 ALL NULL NULL NULL NULL 1
|
||||||
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
||||||
WHERE t3.b IN (SELECT b FROM t4);
|
WHERE t3.b IN (SELECT b FROM t4);
|
||||||
|
@ -55,8 +55,9 @@ a b
|
|||||||
19 14
|
19 14
|
||||||
explain select * from t2 where b in (select a from t1);
|
explain select * from t2 where b in (select a from t1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
|
||||||
1 PRIMARY t2 ref b b 5 test.t1.a 2 End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
1 PRIMARY t2 ref b b 5 test.t1.a 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
select * from t2 where b in (select a from t1);
|
select * from t2 where b in (select a from t1);
|
||||||
a b
|
a b
|
||||||
1 1
|
1 1
|
||||||
@ -74,8 +75,9 @@ insert into t3 select a,a, a,a,a from t0;
|
|||||||
insert into t3 select a,a, a+100,a+100,a+100 from t0;
|
insert into t3 select a,a, a+100,a+100,a+100 from t0;
|
||||||
explain select * from t3 where b in (select a from t1);
|
explain select * from t3 where b in (select a from t1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Start temporary
|
1 PRIMARY t3 ALL b NULL NULL NULL 20
|
||||||
1 PRIMARY t3 ref b b 5 test.t1.a 1 End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3
|
||||||
select * from t3 where b in (select a from t1);
|
select * from t3 where b in (select a from t1);
|
||||||
a b pk1 pk2 pk3
|
a b pk1 pk2 pk3
|
||||||
1 1 1 1 1
|
1 1 1 1 1
|
||||||
@ -99,8 +101,9 @@ A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a
|
|||||||
from t0 A, t0 B where B.a <5;
|
from t0 A, t0 B where B.a <5;
|
||||||
explain select * from t3 where b in (select a from t0);
|
explain select * from t3 where b in (select a from t0);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 10
|
||||||
1 PRIMARY t3 ref b b 5 test.t0.a 1 End temporary; (flat, BKA join); Key-ordered Rowid-ordered scan
|
1 PRIMARY t3 ref b b 5 test.t0.a 1 (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||||
|
2 SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
|
||||||
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
|
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
|
||||||
a b pk1 pk2
|
a b pk1 pk2
|
||||||
0 0 0 0
|
0 0 0 0
|
||||||
@ -149,8 +152,9 @@ explain select
|
|||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 22 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 22
|
||||||
1 PRIMARY ot hash_ALL NULL #hash#$hj 5 test.it.a 32 Using where; End temporary; Using join buffer (flat, BNLH join)
|
1 PRIMARY ot hash_ALL NULL #hash#$hj 5 test.it.a 32 Using where; Using join buffer (flat, BNLH join)
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 22 Using where
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
@ -182,7 +186,8 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 32 Using where; FirstMatch(ot); Using join buffer (flat, BNL join)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 32
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
@ -206,8 +211,8 @@ a mid(filler1, 1,10) length(filler1)=length(filler2)
|
|||||||
16 filler1234 1
|
16 filler1234 1
|
||||||
17 filler1234 1
|
17 filler1234 1
|
||||||
18 filler1234 1
|
18 filler1234 1
|
||||||
3 duplicate 1
|
|
||||||
19 filler1234 1
|
19 filler1234 1
|
||||||
|
3 duplicate 1
|
||||||
19 duplicate 1
|
19 duplicate 1
|
||||||
insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
|
insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
|
||||||
insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
|
insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
|
||||||
@ -215,8 +220,9 @@ explain select
|
|||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 22 Using where; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 22
|
||||||
1 PRIMARY ot hash_ALL NULL #hash#$hj 5 test.it.a 52 Using where; End temporary; Using join buffer (flat, BNLH join)
|
1 PRIMARY ot hash_ALL NULL #hash#$hj 5 test.it.a 52 Using where; Using join buffer (flat, BNLH join)
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 22 Using where
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
|
||||||
from t1 ot where a in (select a from t2 it);
|
from t1 ot where a in (select a from t2 it);
|
||||||
@ -248,7 +254,8 @@ a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
|||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
1 PRIMARY ot ALL NULL NULL NULL NULL 22
|
||||||
1 PRIMARY it ALL NULL NULL NULL NULL 52 Using where; FirstMatch(ot); Using join buffer (flat, BNL join)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY it ALL NULL NULL NULL NULL 52
|
||||||
select
|
select
|
||||||
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
a, mid(filler1, 1,10), length(filler1)=length(filler2)
|
||||||
from t2 ot where a in (select a from t1 it);
|
from t2 ot where a in (select a from t1 it);
|
||||||
@ -272,8 +279,8 @@ a mid(filler1, 1,10) length(filler1)=length(filler2)
|
|||||||
16 filler1234 1
|
16 filler1234 1
|
||||||
17 filler1234 1
|
17 filler1234 1
|
||||||
18 filler1234 1
|
18 filler1234 1
|
||||||
3 duplicate 1
|
|
||||||
19 filler1234 1
|
19 filler1234 1
|
||||||
|
3 duplicate 1
|
||||||
19 duplicate 1
|
19 duplicate 1
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
create table t1 (a int, b int, key(a));
|
create table t1 (a int, b int, key(a));
|
||||||
@ -288,9 +295,10 @@ from t0 where a in
|
|||||||
(select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a);
|
(select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t0 ALL NULL NULL NULL NULL 10
|
1 PRIMARY t0 ALL NULL NULL NULL NULL 10
|
||||||
1 PRIMARY t1 index a a 5 NULL 10 Using where; Using index
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 9 func 1 Using where
|
||||||
1 PRIMARY t2 ref a a 5 test.t1.a 1 Using index
|
2 SUBQUERY t1 index a a 5 NULL 10 Using where; Using index
|
||||||
1 PRIMARY t3 ref a a 5 test.t1.a 1 Using index; FirstMatch(t0)
|
2 SUBQUERY t2 ref a a 5 test.t1.a 1 Using index
|
||||||
|
2 SUBQUERY t3 ref a a 5 test.t1.a 1 Using index
|
||||||
drop table t0, t1,t2,t3;
|
drop table t0, t1,t2,t3;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
ID int(11) NOT NULL auto_increment,
|
ID int(11) NOT NULL auto_increment,
|
||||||
@ -367,7 +375,8 @@ WHERE t1.Code IN (
|
|||||||
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31
|
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31
|
||||||
1 PRIMARY t2 ref CountryCode CountryCode 3 test.t1.Code 18 Using where; FirstMatch(t1); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1
|
||||||
|
2 SUBQUERY t2 ALL CountryCode NULL NULL NULL 545 Using where
|
||||||
SELECT Name FROM t1
|
SELECT Name FROM t1
|
||||||
WHERE t1.Code IN (
|
WHERE t1.Code IN (
|
||||||
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
|
||||||
@ -604,7 +613,7 @@ select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t3));
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||||
1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join)
|
1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join)
|
||||||
2 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
|
2 SUBQUERY t3 index PRIMARY PRIMARY 4 NULL 10 Using index
|
||||||
drop table t0, t1, t2, t3;
|
drop table t0, t1, t2, t3;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
@ -716,8 +725,9 @@ alter table t3 add primary key(id), add key(a);
|
|||||||
The following must use loose index scan over t3, key a:
|
The following must use loose index scan over t3, key a:
|
||||||
explain select count(a) from t2 where a in ( SELECT a FROM t3);
|
explain select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 index a a 5 NULL 1000 Using where; Using index
|
1 PRIMARY t2 index a a 5 NULL 1000 Using index
|
||||||
1 PRIMARY t3 ref a a 5 test.t2.a 30 Using index; FirstMatch(t2)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY t3 index a a 5 NULL 30000 Using index
|
||||||
select count(a) from t2 where a in ( SELECT a FROM t3);
|
select count(a) from t2 where a in ( SELECT a FROM t3);
|
||||||
count(a)
|
count(a)
|
||||||
1000
|
1000
|
||||||
@ -872,10 +882,11 @@ EXPLAIN
|
|||||||
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
||||||
WHERE t3.b IN (SELECT b FROM t4);
|
WHERE t3.b IN (SELECT b FROM t4);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where; Start temporary
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 1
|
||||||
1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t3.a 1 Using where; Using join buffer (flat, BNLH join)
|
1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t3.a 1 Using where; Using join buffer (flat, BNLH join)
|
||||||
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
|
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
|
||||||
1 PRIMARY t4 hash_ALL NULL #hash#$hj 5 test.t3.b 2 Using where; End temporary; Using join buffer (incremental, BNLH join)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
|
2 SUBQUERY t4 ALL NULL NULL NULL NULL 2
|
||||||
3 DERIVED t1 ALL NULL NULL NULL NULL 1
|
3 DERIVED t1 ALL NULL NULL NULL NULL 1
|
||||||
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
|
||||||
WHERE t3.b IN (SELECT b FROM t4);
|
WHERE t3.b IN (SELECT b FROM t4);
|
||||||
|
@ -890,4 +890,4 @@ set optimizer_switch=@subselect_sj2_tmp;
|
|||||||
set optimizer_switch=default;
|
set optimizer_switch=default;
|
||||||
select @@optimizer_switch like '%materialization=on%';
|
select @@optimizer_switch like '%materialization=on%';
|
||||||
@@optimizer_switch like '%materialization=on%'
|
@@optimizer_switch like '%materialization=on%'
|
||||||
0
|
1
|
||||||
|
@ -90,18 +90,18 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
|
|||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||||
1 PRIMARY A ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join)
|
1 PRIMARY A ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join)
|
||||||
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join)
|
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join)
|
||||||
2 DEPENDENT SUBQUERY t10 unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index
|
2 SUBQUERY t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,<exists>(<primAry_index_lookup>(<cAche>(`test`.`B`.`A`) in t10 on PRIMARY))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1
|
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1
|
||||||
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
|
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
|
||||||
explAin extended
|
explAin extended
|
||||||
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
|
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
|
||||||
id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
|
id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join)
|
||||||
2 DEPENDENT SUBQUERY t10 unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index
|
2 SUBQUERY t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,<exists>(<primAry_index_lookup>(<cAche>(`test`.`t2`.`A`) in t10 on PRIMARY))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1
|
Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,`test`.`t2`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t2`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t2`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1
|
||||||
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
|
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
|
||||||
explain select * from
|
explain select * from
|
||||||
t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
|
t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
|
||||||
@ -735,9 +735,10 @@ SELECT int_key FROM ot1
|
|||||||
WHERE int_nokey IN (SELECT it2.int_key
|
WHERE int_nokey IN (SELECT it2.int_key
|
||||||
FROM it1 LEFT JOIN it2 ON it2.datetime_key);
|
FROM it1 LEFT JOIN it2 ON it2.datetime_key);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY it1 index NULL int_key 4 NULL 2 Using index; Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 11
|
||||||
1 PRIMARY ot1 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
|
1 PRIMARY ot1 ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY it2 ALL int_key,datetime_key NULL NULL NULL 20 Using where; End temporary; Using join buffer (incremental, BNL join)
|
2 SUBQUERY it1 index NULL int_key 4 NULL 2 Using index
|
||||||
|
2 SUBQUERY it2 ALL int_key,datetime_key NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
|
||||||
DROP TABLE ot1, it1, it2;
|
DROP TABLE ot1, it1, it2;
|
||||||
# End of BUG#38075
|
# End of BUG#38075
|
||||||
#
|
#
|
||||||
@ -809,9 +810,10 @@ INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii','iiii','ffff','ffff','ffff','f
|
|||||||
EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 13 func,func 1 100.00
|
||||||
|
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Rowid-ordered scan
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`pk` > 0))
|
Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0))
|
||||||
SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
|
||||||
pk
|
pk
|
||||||
2
|
2
|
||||||
@ -977,9 +979,10 @@ FROM t1
|
|||||||
WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
|
WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00
|
||||||
1 PRIMARY t1 ref varchar_key varchar_key 3 test.t2.varchar_nokey 2 100.00 Using where; FirstMatch(t2); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
|
||||||
|
2 SUBQUERY t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_key` = `test`.`t2`.`varchar_nokey`) and (`test`.`t1`.`varchar_nokey` = `test`.`t2`.`varchar_nokey`) and ((`test`.`t2`.`varchar_nokey` < 'n') xor `test`.`t1`.`pk`))
|
Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_key` < 'n') xor `test`.`t1`.`pk`))
|
||||||
SELECT varchar_nokey
|
SELECT varchar_nokey
|
||||||
FROM t2
|
FROM t2
|
||||||
WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
|
WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
|
||||||
@ -1057,9 +1060,11 @@ WHERE t2.val LIKE 'a%' OR t2.val LIKE 'e%')
|
|||||||
AND t1.val IN (SELECT t3.val FROM t3
|
AND t1.val IN (SELECT t3.val FROM t3
|
||||||
WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%');
|
WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%');
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Start temporary
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 14 func 1
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (incremental, BNL join)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 14 func 1
|
||||||
|
3 SUBQUERY t3 ALL NULL NULL NULL NULL 5 Using where
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 Using where
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM t1
|
FROM t1
|
||||||
WHERE t1.val IN (SELECT t2.val FROM t2
|
WHERE t1.val IN (SELECT t2.val FROM t2
|
||||||
@ -1277,10 +1282,12 @@ explain
|
|||||||
select * from t1 A, t1 B
|
select * from t1 A, t1 B
|
||||||
where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D);
|
where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY A ALL NULL NULL NULL NULL 3 Start temporary
|
1 PRIMARY A ALL NULL NULL NULL NULL 3
|
||||||
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
|
||||||
1 PRIMARY B ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY B ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY C ALL NULL NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join)
|
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 5 func 1
|
||||||
1 PRIMARY D ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (incremental, BNL join)
|
2 SUBQUERY C ALL NULL NULL NULL NULL 3
|
||||||
|
3 SUBQUERY D ALL NULL NULL NULL NULL 3
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
#
|
#
|
||||||
# BUG#784441: Abort on semijoin with a view as the inner table
|
# BUG#784441: Abort on semijoin with a view as the inner table
|
||||||
@ -1295,7 +1302,7 @@ SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||||
2 DEPENDENT SUBQUERY <derived3> system NULL NULL NULL NULL 1
|
2 SUBQUERY <derived3> system NULL NULL NULL NULL 1
|
||||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
||||||
a a
|
a a
|
||||||
@ -1398,9 +1405,10 @@ insert into t3 values('three'),( 'four');
|
|||||||
insert into t3 values('three'),( 'four');
|
insert into t3 values('three'),( 'four');
|
||||||
explain select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
explain select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Start temporary
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where; End temporary; Using join buffer (incremental, BNL join)
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||||
select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
|
||||||
b
|
b
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
@ -2071,6 +2079,39 @@ a
|
|||||||
3
|
3
|
||||||
set optimizer_switch= @tmp_otimizer_switch;
|
set optimizer_switch= @tmp_otimizer_switch;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# Bug #887496: semijoin with IN equality for the second part of an index
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
INSERT INTO t1 VALUES (9), (0), (8), (5);
|
||||||
|
CREATE TABLE t2 (a int, b varchar(1), INDEX idx (b,a));
|
||||||
|
INSERT INTO t2 VALUES (5,'r'), (5,'z');
|
||||||
|
CREATE TABLE t3 (a int, b varchar(1), INDEX idx (b,a));
|
||||||
|
INSERT INTO t3 VALUES (5,'r'), (5,'z');
|
||||||
|
set @tmp_otimizer_switch= @@optimizer_switch;
|
||||||
|
SET SESSION optimizer_switch='semijoin=on,firstmatch=on';
|
||||||
|
SET SESSION optimizer_switch='loosescan=off';
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary
|
||||||
|
1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join)
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
a
|
||||||
|
5
|
||||||
|
SET SESSION optimizer_switch='loosescan=on';
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary
|
||||||
|
1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join)
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
a
|
||||||
|
5
|
||||||
|
set optimizer_switch= @tmp_otimizer_switch;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
#
|
#
|
||||||
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
||||||
@ -2104,6 +2145,54 @@ a
|
|||||||
3
|
3
|
||||||
set optimizer_switch=@save_optimizer_switch;
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t0, t1, t2;
|
drop table t0, t1, t2;
|
||||||
|
#
|
||||||
|
# Bug #891995: IN subquery with join_cache_level >= 3
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a varchar(1));
|
||||||
|
INSERT INTO t1 VALUES ('w'),('q');
|
||||||
|
CREATE TABLE t2 (a int NOT NULL, b time, PRIMARY KEY (a));
|
||||||
|
INSERT INTO t2 VALUES
|
||||||
|
(2,'18:56:33'), (5,'19:11:10'), (3,'18:56:33'), (7,'19:11:10');
|
||||||
|
CREATE TABLE t3 (
|
||||||
|
a int NOT NULL, b int, c int, d varchar(1), PRIMARY KEY (a), KEY (d,c)
|
||||||
|
);
|
||||||
|
INSERT INTO t3 VALUES
|
||||||
|
(25,158,10,'f'), (26,5,2,'v'), (27,163,103,'f'), (28,2,3,'q'), (29,8,6,'y');
|
||||||
|
set @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
SET SESSION optimizer_switch='semijoin=on';
|
||||||
|
SET SESSION optimizer_switch='join_cache_hashed=on';
|
||||||
|
SET SESSION join_cache_level=3;
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Start temporary
|
||||||
|
1 PRIMARY t3 ALL d NULL NULL NULL 5 Range checked for each record (index map: 0x2)
|
||||||
|
1 PRIMARY t2 hash_ALL PRIMARY #hash#PRIMARY 4 test.t3.b 4 End temporary; Using join buffer (flat, BNLH join)
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
a a b
|
||||||
|
w 2 18:56:33
|
||||||
|
q 2 18:56:33
|
||||||
|
w 5 19:11:10
|
||||||
|
SET SESSION optimizer_switch='mrr=on';
|
||||||
|
SET SESSION join_cache_level=6;
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Start temporary
|
||||||
|
1 PRIMARY t3 ALL d NULL NULL NULL 5 Range checked for each record (index map: 0x2)
|
||||||
|
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t3.b 1 End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
a a b
|
||||||
|
w 2 18:56:33
|
||||||
|
q 2 18:56:33
|
||||||
|
w 5 19:11:10
|
||||||
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
|
set join_cache_level=default;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
# End
|
# End
|
||||||
set join_cache_level=default;
|
set join_cache_level=default;
|
||||||
show variables like 'join_cache_level';
|
show variables like 'join_cache_level';
|
||||||
|
@ -128,7 +128,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3
|
|||||||
This should use facts and a1 tables:
|
This should use facts and a1 tables:
|
||||||
explain extended select id from v1 where attr1 between 12 and 14;
|
explain extended select id from v1 where attr1 between 12 and 14;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using where
|
1 SIMPLE a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition
|
||||||
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index
|
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2
|
Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2
|
||||||
@ -136,7 +136,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` whe
|
|||||||
This should use facts, a2 and its subquery:
|
This should use facts, a2 and its subquery:
|
||||||
explain extended select id from v1 where attr2 between 12 and 14;
|
explain extended select id from v1 where attr2 between 12 and 14;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using where
|
1 SIMPLE a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using index condition; Using where
|
||||||
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using index
|
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using index
|
||||||
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index
|
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
@ -156,7 +156,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3
|
|||||||
This should use facts and a1 tables:
|
This should use facts and a1 tables:
|
||||||
explain extended select id from v2 where attr1 between 12 and 14;
|
explain extended select id from v2 where attr1 between 12 and 14;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using where
|
1 SIMPLE a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition
|
||||||
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index
|
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2
|
Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2
|
||||||
@ -164,7 +164,7 @@ Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` whe
|
|||||||
This should use facts, a2 and its subquery:
|
This should use facts, a2 and its subquery:
|
||||||
explain extended select id from v2 where attr2 between 12 and 14;
|
explain extended select id from v2 where attr2 between 12 and 14;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using where
|
1 SIMPLE a2 range PRIMARY,attr2 attr2 5 NULL 5 100.00 Using index condition
|
||||||
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using where; Using index
|
1 SIMPLE f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using where; Using index
|
||||||
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index
|
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
|
@ -236,7 +236,7 @@ explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelo
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
|
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
|
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
|
||||||
SELECT fid, X(g) FROM gis_point ORDER by fid;
|
SELECT fid, X(g) FROM gis_point ORDER by fid;
|
||||||
fid X(g)
|
fid X(g)
|
||||||
101 10
|
101 10
|
||||||
@ -253,7 +253,7 @@ explain extended select X(g),Y(g) FROM gis_point;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
|
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
|
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
|
||||||
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
|
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
|
||||||
fid AsText(StartPoint(g))
|
fid AsText(StartPoint(g))
|
||||||
105 POINT(0 0)
|
105 POINT(0 0)
|
||||||
@ -288,7 +288,7 @@ explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),Num
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
|
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
|
||||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||||
fid AsText(Centroid(g))
|
fid AsText(Centroid(g))
|
||||||
108 POINT(15 15)
|
108 POINT(15 15)
|
||||||
@ -318,7 +318,7 @@ explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumI
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
|
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
|
||||||
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
|
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
|
||||||
fid IsClosed(g)
|
fid IsClosed(g)
|
||||||
114 0
|
114 0
|
||||||
@ -357,7 +357,7 @@ explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
|
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
|
||||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
|
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
|
||||||
fid AsText(GeometryN(g, 2))
|
fid AsText(GeometryN(g, 2))
|
||||||
111 POINT(10 10)
|
111 POINT(10 10)
|
||||||
@ -385,17 +385,17 @@ explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
|
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
|
||||||
SELECT g1.fid as first, g2.fid as second,
|
SELECT g1.fid as first, g2.fid as second,
|
||||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 1 1 0
|
||||||
120 121 0 0 1 0 0 0 1 0
|
120 121 0 0 1 0 0 0 1 0
|
||||||
121 120 0 0 1 0 0 0 1 0
|
121 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 1 1 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||||
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
|
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
|
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
|
||||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
a INTEGER PRIMARY KEY AUTO_INCREMENT,
|
a INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||||
@ -494,7 +494,7 @@ mbroverlaps
|
|||||||
down,left,right,up
|
down,left,right,up
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
mbrtouches
|
mbrtouches
|
||||||
down2,left2,right2,up2
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
mbrwithin
|
mbrwithin
|
||||||
big,center
|
big,center
|
||||||
@ -515,7 +515,7 @@ overlaps
|
|||||||
down,left,right,up
|
down,left,right,up
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
touches
|
touches
|
||||||
down2,left2,right2,up2
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
within
|
within
|
||||||
big,center
|
big,center
|
||||||
|
@ -2880,7 +2880,7 @@ SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
|
|||||||
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
||||||
ORDER BY t1.a;
|
ORDER BY t1.a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using filesort
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using index condition; Using filesort
|
||||||
1 SIMPLE t2 ref a a 5 test.t1.pk 1 Using index
|
1 SIMPLE t2 ref a a 5 test.t1.pk 1 Using index
|
||||||
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
|
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
|
||||||
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
||||||
|
@ -139,6 +139,7 @@ insert into t1 values (1,1), (2,null), (3,1), (4,1),
|
|||||||
--echo # used later in the test JT_EQ_REF access method is used.
|
--echo # used later in the test JT_EQ_REF access method is used.
|
||||||
--echo #
|
--echo #
|
||||||
--vertical_results
|
--vertical_results
|
||||||
|
--replace_result "Using index condition; Using where" "Using where"
|
||||||
explain
|
explain
|
||||||
select 1 from t1 natural join (select 2 as a, 1 as b union all
|
select 1 from t1 natural join (select 2 as a, 1 as b union all
|
||||||
select 2 as a, 2 as b) as t2 for update;
|
select 2 as a, 2 as b) as t2 for update;
|
||||||
@ -235,6 +236,7 @@ begin;
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # Verify that JT_EQ_REF is used.
|
--echo # Verify that JT_EQ_REF is used.
|
||||||
--vertical_results
|
--vertical_results
|
||||||
|
--replace_result "Using index condition; Using where" "Using where"
|
||||||
explain
|
explain
|
||||||
select 1 from t1 natural join (select 3 as a, 2 as b union all
|
select 1 from t1 natural join (select 3 as a, 2 as b union all
|
||||||
select 3 as a, 1 as b) as t2 for update;
|
select 3 as a, 1 as b) as t2 for update;
|
||||||
|
@ -1041,6 +1041,8 @@ INSERT INTO t1 VALUES
|
|||||||
|
|
||||||
SET SESSION join_cache_level = 0;
|
SET SESSION join_cache_level = 0;
|
||||||
|
|
||||||
|
# vanilla InnoDB doesn't do ICP
|
||||||
|
--replace_result "Using where" "Using index condition"
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
|
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
|
||||||
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
||||||
|
@ -168,7 +168,7 @@ count(*)
|
|||||||
150
|
150
|
||||||
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range g g 34 NULL 11 Using where
|
1 SIMPLE t1 ALL g NULL NULL NULL 150 Using where
|
||||||
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
1 LINESTRING(150 150,150 150)
|
1 LINESTRING(150 150,150 150)
|
||||||
@ -302,14 +302,10 @@ count(*)
|
|||||||
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range g g 34 NULL 4 Using where
|
1 SIMPLE t2 range g g 34 NULL 1 Using where
|
||||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
45 LINESTRING(51 51,60 60)
|
|
||||||
46 LINESTRING(51 41,60 50)
|
|
||||||
55 LINESTRING(41 51,50 60)
|
|
||||||
56 LINESTRING(41 41,50 50)
|
|
||||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
||||||
SELECT count(*) FROM t2;
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -168,7 +168,7 @@ count(*)
|
|||||||
150
|
150
|
||||||
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range g g 34 NULL 11 Using where
|
1 SIMPLE t1 ALL g NULL NULL NULL 150 Using where
|
||||||
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
1 LINESTRING(150 150,150 150)
|
1 LINESTRING(150 150,150 150)
|
||||||
@ -302,14 +302,10 @@ count(*)
|
|||||||
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range g g 34 NULL 4 Using where
|
1 SIMPLE t2 range g g 34 NULL 1 Using where
|
||||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
45 LINESTRING(51 51,60 60)
|
|
||||||
46 LINESTRING(51 41,60 50)
|
|
||||||
55 LINESTRING(41 51,50 60)
|
|
||||||
56 LINESTRING(41 41,50 50)
|
|
||||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
||||||
SELECT count(*) FROM t2;
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -168,7 +168,7 @@ count(*)
|
|||||||
150
|
150
|
||||||
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range g g 34 NULL 11 Using where
|
1 SIMPLE t1 ALL g NULL NULL NULL 150 Using where
|
||||||
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
1 LINESTRING(150 150,150 150)
|
1 LINESTRING(150 150,150 150)
|
||||||
@ -302,14 +302,10 @@ count(*)
|
|||||||
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range g g 34 NULL 4 Using where
|
1 SIMPLE t2 range g g 34 NULL 1 Using where
|
||||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
fid AsText(g)
|
fid AsText(g)
|
||||||
45 LINESTRING(51 51,60 60)
|
|
||||||
46 LINESTRING(51 41,60 50)
|
|
||||||
55 LINESTRING(41 51,50 60)
|
|
||||||
56 LINESTRING(41 41,50 50)
|
|
||||||
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
|
||||||
SELECT count(*) FROM t2;
|
SELECT count(*) FROM t2;
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -401,10 +401,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 ref a a 4 test.t2.a 1
|
1 SIMPLE t1 ref a a 4 test.t2.a 1
|
||||||
explain select * from t1 where a=0 or a=2;
|
explain select * from t1 where a=0 or a=2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 4 NULL 5 Using where
|
1 SIMPLE t1 range a a 4 NULL 5 Using index condition; Using where
|
||||||
explain select * from t1 force index (a) where a=0 or a=2;
|
explain select * from t1 force index (a) where a=0 or a=2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 4 NULL 5 Using where
|
1 SIMPLE t1 range a a 4 NULL 5 Using index condition; Using where
|
||||||
explain select * from t1 where c=1;
|
explain select * from t1 where c=1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref c,c_2 c 5 const 2
|
1 SIMPLE t1 ref c,c_2 c 5 const 2
|
||||||
|
@ -1172,7 +1172,8 @@ EXPLAIN SELECT 1 FROM t1 WHERE a IN
|
|||||||
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index
|
1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 144 Using where; FirstMatch(t1)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 144
|
||||||
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
CREATE TABLE t2 (a INT, b INT, KEY(a));
|
||||||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
|
||||||
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
|
||||||
@ -1185,5 +1186,6 @@ EXPLAIN SELECT 1 FROM t2 WHERE a IN
|
|||||||
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t2 index a a 5 NULL 4 Using index
|
1 PRIMARY t2 index a a 5 NULL 4 Using index
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 144 Using where; FirstMatch(t2)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 144
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
@ -2256,8 +2256,9 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
|
||||||
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using where; Using index
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 15 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index NULL a 10 NULL 1 Using index
|
1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 1 Using index
|
||||||
|
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
|
||||||
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
|
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
|
||||||
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
@ -76,13 +76,13 @@ insert into t2 select * from t1;
|
|||||||
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
||||||
explain select * from t1 where a is null and b = 2;
|
explain select * from t1 where a is null and b = 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a is null and b = 2 and c=0;
|
explain select * from t1 where a is null and b = 2 and c=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a is null and b = 7 and c=0;
|
explain select * from t1 where a is null and b = 7 and c=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a=2 and b = 2;
|
explain select * from t1 where a=2 and b = 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 1 Using where
|
1 SIMPLE t1 ref a,b a 5 const 1 Using where
|
||||||
@ -91,25 +91,25 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where
|
||||||
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
|
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a,b a 5 NULL 5 Using where
|
1 SIMPLE t1 range a,b a 5 NULL 5 Using index condition; Using where
|
||||||
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
|
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where
|
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using index condition; Using where
|
||||||
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
|
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
1 SIMPLE t1 ref a,b a 5 const 3 Using index condition; Using where
|
||||||
explain select * from t1 where a > 1 and a < 3 limit 1;
|
explain select * from t1 where a > 1 and a < 3 limit 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 1 Using where
|
1 SIMPLE t1 range a a 5 NULL 1 Using index condition
|
||||||
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
|
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a,b a 5 NULL 4 Using where
|
1 SIMPLE t1 range a,b a 5 NULL 4 Using index condition; Using where
|
||||||
explain select * from t1 where a > 8 and a < 9;
|
explain select * from t1 where a > 8 and a < 9;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a a 5 NULL 1 Using where
|
1 SIMPLE t1 range a a 5 NULL 1 Using index condition
|
||||||
explain select * from t1 where b like "6%";
|
explain select * from t1 where b like "6%";
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range b b 12 NULL 1 Using where
|
1 SIMPLE t1 range b b 12 NULL 1 Using where
|
||||||
@ -258,7 +258,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
|
|||||||
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
|
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
|
||||||
explain select id from t1 where uniq_id is null;
|
explain select id from t1 where uniq_id is null;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where
|
1 SIMPLE t1 ref idx1 idx1 5 const 5 Using index condition
|
||||||
explain select id from t1 where uniq_id =1;
|
explain select id from t1 where uniq_id =1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const idx1 idx1 5 const 1
|
1 SIMPLE t1 const idx1 idx1 5 const 1
|
||||||
|
@ -514,7 +514,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
|
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
|
||||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
`titre` char(80) NOT NULL default '',
|
`titre` char(80) NOT NULL default '',
|
||||||
|
@ -468,9 +468,9 @@ def key 253 64 7 Y 0 31 8
|
|||||||
def key_len 253 4096 1 Y 0 31 8
|
def key_len 253 4096 1 Y 0 31 8
|
||||||
def ref 253 2048 0 Y 0 31 8
|
def ref 253 2048 0 Y 0 31 8
|
||||||
def rows 8 10 1 Y 32928 0 63
|
def rows 8 10 1 Y 32928 0 63
|
||||||
def Extra 253 255 27 N 1 31 8
|
def Extra 253 255 37 N 1 31 8
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
|
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using filesort
|
||||||
drop table if exists t2;
|
drop table if exists t2;
|
||||||
create table t2 (id smallint, name varchar(20)) ;
|
create table t2 (id smallint, name varchar(20)) ;
|
||||||
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
|
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
|
||||||
|
@ -277,7 +277,7 @@ INSERT INTO t1 VALUES
|
|||||||
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
|
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
|
||||||
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range a,b a 5 NULL 2 Using where
|
1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where
|
||||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||||
a b
|
a b
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@ -902,7 +902,7 @@ INSERT INTO t1 VALUES
|
|||||||
('A2','2005-12-01 08:00:00',1000);
|
('A2','2005-12-01 08:00:00',1000);
|
||||||
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where
|
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition
|
||||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||||
item started price
|
item started price
|
||||||
Warnings:
|
Warnings:
|
||||||
|
@ -2835,9 +2835,10 @@ Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cac
|
|||||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1)
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func,func 1 100.00
|
||||||
|
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`two` = `test`.`t1`.`two`) and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`flag` = 'N'))
|
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N'))
|
||||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||||
@ -3427,7 +3428,8 @@ EXPLAIN
|
|||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
ALTER TABLE t1 ADD INDEX(a);
|
ALTER TABLE t1 ADD INDEX(a);
|
||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
a b
|
a b
|
||||||
@ -3437,8 +3439,9 @@ AAA 8
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
|
1 PRIMARY t1 ALL a NULL NULL NULL 9 Using where
|
||||||
2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 1
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 23 test.t1.a,test.t1.b 1
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1( f1 int,f2 int);
|
create table t1( f1 int,f2 int);
|
||||||
insert into t1 values (1,1),(2,2);
|
insert into t1 values (1,1),(2,2);
|
||||||
|
@ -9,7 +9,7 @@ SELECT @global_start_value;
|
|||||||
select @old_session_opt_switch:=@@session.optimizer_switch,
|
select @old_session_opt_switch:=@@session.optimizer_switch,
|
||||||
@old_global_opt_switch:=@@global.optimizer_switch;
|
@old_global_opt_switch:=@@global.optimizer_switch;
|
||||||
@old_session_opt_switch:=@@session.optimizer_switch @old_global_opt_switch:=@@global.optimizer_switch
|
@old_session_opt_switch:=@@session.optimizer_switch @old_global_opt_switch:=@@global.optimizer_switch
|
||||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
'#--------------------FN_DYNVARS_028_01------------------------#'
|
'#--------------------FN_DYNVARS_028_01------------------------#'
|
||||||
SET @@session.engine_condition_pushdown = 0;
|
SET @@session.engine_condition_pushdown = 0;
|
||||||
Warnings:
|
Warnings:
|
||||||
@ -212,7 +212,7 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@session.engine_condition_pushdown = TRUE;
|
set @@session.engine_condition_pushdown = TRUE;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
||||||
@ -220,7 +220,7 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@session.engine_condition_pushdown = FALSE;
|
set @@session.engine_condition_pushdown = FALSE;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
||||||
@ -228,7 +228,7 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@global.engine_condition_pushdown = TRUE;
|
set @@global.engine_condition_pushdown = TRUE;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
||||||
@ -236,7 +236,7 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@global.engine_condition_pushdown = FALSE;
|
set @@global.engine_condition_pushdown = FALSE;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
||||||
@ -244,31 +244,31 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@session.optimizer_switch = "engine_condition_pushdown=on";
|
set @@session.optimizer_switch = "engine_condition_pushdown=on";
|
||||||
select @@session.engine_condition_pushdown,
|
select @@session.engine_condition_pushdown,
|
||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@session.optimizer_switch = "engine_condition_pushdown=off";
|
set @@session.optimizer_switch = "engine_condition_pushdown=off";
|
||||||
select @@session.engine_condition_pushdown,
|
select @@session.engine_condition_pushdown,
|
||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@global.optimizer_switch = "engine_condition_pushdown=on";
|
set @@global.optimizer_switch = "engine_condition_pushdown=on";
|
||||||
select @@session.engine_condition_pushdown,
|
select @@session.engine_condition_pushdown,
|
||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set @@global.optimizer_switch = "engine_condition_pushdown=off";
|
set @@global.optimizer_switch = "engine_condition_pushdown=off";
|
||||||
select @@session.engine_condition_pushdown,
|
select @@session.engine_condition_pushdown,
|
||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
SET @@session.engine_condition_pushdown = @session_start_value;
|
SET @@session.engine_condition_pushdown = @session_start_value;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
|
||||||
@ -287,4 +287,4 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
SET @start_global_value = @@global.optimizer_switch;
|
SET @start_global_value = @@global.optimizer_switch;
|
||||||
SELECT @start_global_value;
|
SELECT @start_global_value;
|
||||||
@start_global_value
|
@start_global_value
|
||||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
select @@global.optimizer_switch;
|
select @@global.optimizer_switch;
|
||||||
@@global.optimizer_switch
|
@@global.optimizer_switch
|
||||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
select @@session.optimizer_switch;
|
select @@session.optimizer_switch;
|
||||||
@@session.optimizer_switch
|
@@session.optimizer_switch
|
||||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
show global variables like 'optimizer_switch';
|
show global variables like 'optimizer_switch';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
show session variables like 'optimizer_switch';
|
show session variables like 'optimizer_switch';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
select * from information_schema.global_variables where variable_name='optimizer_switch';
|
select * from information_schema.global_variables where variable_name='optimizer_switch';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
select * from information_schema.session_variables where variable_name='optimizer_switch';
|
select * from information_schema.session_variables where variable_name='optimizer_switch';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
set global optimizer_switch=10;
|
set global optimizer_switch=10;
|
||||||
set session optimizer_switch=5;
|
set session optimizer_switch=5;
|
||||||
select @@global.optimizer_switch;
|
select @@global.optimizer_switch;
|
||||||
@ -63,4 +63,4 @@ ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'foobar'
|
|||||||
SET @@global.optimizer_switch = @start_global_value;
|
SET @@global.optimizer_switch = @start_global_value;
|
||||||
SELECT @@global.optimizer_switch;
|
SELECT @@global.optimizer_switch;
|
||||||
@@global.optimizer_switch
|
@@global.optimizer_switch
|
||||||
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
|
@ -2,4 +2,4 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
1 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
1 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
|
@ -2,4 +2,4 @@ select @@session.engine_condition_pushdown,
|
|||||||
@@global.engine_condition_pushdown,
|
@@global.engine_condition_pushdown,
|
||||||
@@session.optimizer_switch, @@global.optimizer_switch;
|
@@session.optimizer_switch, @@global.optimizer_switch;
|
||||||
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
|
||||||
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
|
||||||
|
@ -22,7 +22,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t2 where c=-1;
|
explain select * from t2 where c=-1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref c c 5 const 1 Using where
|
1 SIMPLE t2 ref c c 5 const 1 Using index condition
|
||||||
# select_type=SIMPLE, type=ALL
|
# select_type=SIMPLE, type=ALL
|
||||||
select * from t1 where b=-1;
|
select * from t1 where b=-1;
|
||||||
a b c
|
a b c
|
||||||
@ -44,7 +44,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c>=-1;
|
explain select * from t3 where c>=-1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 1 Using where
|
1 SIMPLE t3 range c c 5 NULL 1 Using index condition
|
||||||
# select_type=SIMPLE, type=ref
|
# select_type=SIMPLE, type=ref
|
||||||
select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
||||||
a b c a b c
|
a b c a b c
|
||||||
@ -53,7 +53,7 @@ a b c a b c
|
|||||||
explain select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
explain select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 const c c 5 const 1
|
1 SIMPLE t3 const c c 5 const 1
|
||||||
1 SIMPLE t1 ref c c 5 const 2 Using where
|
1 SIMPLE t1 ref c c 5 const 2 Using index condition
|
||||||
# select_type=PRIMARY, type=index,ALL
|
# select_type=PRIMARY, type=index,ALL
|
||||||
select * from t1 where b in (select c from t3);
|
select * from t1 where b in (select c from t3);
|
||||||
a b c
|
a b c
|
||||||
@ -141,7 +141,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c >= -2;
|
explain select * from t3 where c >= -2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 2 Using where
|
1 SIMPLE t3 range c c 5 NULL 2 Using index condition
|
||||||
# SELECT * FROM tbl_name WHERE <non-vcol expr>
|
# SELECT * FROM tbl_name WHERE <non-vcol expr>
|
||||||
select * from t3 where a between 1 and 2;
|
select * from t3 where a between 1 and 2;
|
||||||
a b c
|
a b c
|
||||||
@ -149,7 +149,7 @@ a b c
|
|||||||
2 -2 -2
|
2 -2 -2
|
||||||
explain select * from t3 where a between 1 and 2;
|
explain select * from t3 where a between 1 and 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where
|
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition
|
||||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr>
|
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr>
|
||||||
select * from t3 where b between -2 and -1;
|
select * from t3 where b between -2 and -1;
|
||||||
a b c
|
a b c
|
||||||
@ -165,7 +165,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c between -2 and -1;
|
explain select * from t3 where c between -2 and -1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 2 Using where
|
1 SIMPLE t3 range c c 5 NULL 2 Using index condition
|
||||||
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <non-indexed vcol>
|
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <non-indexed vcol>
|
||||||
select * from t3 where a between 1 and 2 order by b;
|
select * from t3 where a between 1 and 2 order by b;
|
||||||
a b c
|
a b c
|
||||||
@ -173,7 +173,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where a between 1 and 2 order by b;
|
explain select * from t3 where a between 1 and 2 order by b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort
|
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort
|
||||||
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol>
|
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol>
|
||||||
select * from t3 where a between 1 and 2 order by c;
|
select * from t3 where a between 1 and 2 order by c;
|
||||||
a b c
|
a b c
|
||||||
@ -181,7 +181,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where a between 1 and 2 order by c;
|
explain select * from t3 where a between 1 and 2 order by c;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort
|
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort
|
||||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol>
|
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol>
|
||||||
select * from t3 where b between -2 and -1 order by a;
|
select * from t3 where b between -2 and -1 order by a;
|
||||||
a b c
|
a b c
|
||||||
@ -205,7 +205,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c between -2 and -1 order by b;
|
explain select * from t3 where c between -2 and -1 order by b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 2 Using where; Using filesort
|
1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using filesort
|
||||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol>
|
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol>
|
||||||
select * from t3 where b between -2 and -1 order by c;
|
select * from t3 where b between -2 and -1 order by c;
|
||||||
a b c
|
a b c
|
||||||
@ -221,7 +221,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c between -2 and -1 order by c;
|
explain select * from t3 where c between -2 and -1 order by c;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 2 Using where
|
1 SIMPLE t3 range c c 5 NULL 2 Using index condition
|
||||||
# SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol>
|
# SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol>
|
||||||
select sum(b) from t1 group by b;
|
select sum(b) from t1 group by b;
|
||||||
sum(b)
|
sum(b)
|
||||||
|
@ -44,7 +44,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c>=-1;
|
explain select * from t3 where c>=-1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 2 Using where
|
1 SIMPLE t3 range c c 5 NULL 2 Using index condition
|
||||||
# select_type=SIMPLE, type=ref
|
# select_type=SIMPLE, type=ref
|
||||||
select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
||||||
a b c a b c
|
a b c a b c
|
||||||
@ -53,7 +53,7 @@ a b c a b c
|
|||||||
explain select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
explain select * from t1,t3 where t1.c=t3.c and t3.c=-1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 const c c 5 const 1
|
1 SIMPLE t3 const c c 5 const 1
|
||||||
1 SIMPLE t1 ref c c 5 const 2 Using where
|
1 SIMPLE t1 ref c c 5 const 2 Using index condition
|
||||||
# select_type=PRIMARY, type=index,ALL
|
# select_type=PRIMARY, type=index,ALL
|
||||||
select * from t1 where b in (select c from t3);
|
select * from t1 where b in (select c from t3);
|
||||||
a b c
|
a b c
|
||||||
@ -141,7 +141,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c >= -2;
|
explain select * from t3 where c >= -2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 2 Using where
|
1 SIMPLE t3 range c c 5 NULL 2 Using index condition
|
||||||
# SELECT * FROM tbl_name WHERE <non-vcol expr>
|
# SELECT * FROM tbl_name WHERE <non-vcol expr>
|
||||||
select * from t3 where a between 1 and 2;
|
select * from t3 where a between 1 and 2;
|
||||||
a b c
|
a b c
|
||||||
@ -149,7 +149,7 @@ a b c
|
|||||||
2 -2 -2
|
2 -2 -2
|
||||||
explain select * from t3 where a between 1 and 2;
|
explain select * from t3 where a between 1 and 2;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using where
|
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition
|
||||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr>
|
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr>
|
||||||
select * from t3 where b between -2 and -1;
|
select * from t3 where b between -2 and -1;
|
||||||
a b c
|
a b c
|
||||||
@ -165,7 +165,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c between -2 and -1;
|
explain select * from t3 where c between -2 and -1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 1 Using where
|
1 SIMPLE t3 range c c 5 NULL 1 Using index condition
|
||||||
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol>
|
# SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol>
|
||||||
select * from t3 where a between 1 and 2 order by c;
|
select * from t3 where a between 1 and 2 order by c;
|
||||||
a b c
|
a b c
|
||||||
@ -173,7 +173,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where a between 1 and 2 order by c;
|
explain select * from t3 where a between 1 and 2 order by c;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using where; Using filesort
|
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using filesort
|
||||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol>
|
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol>
|
||||||
select * from t3 where b between -2 and -1 order by a;
|
select * from t3 where b between -2 and -1 order by a;
|
||||||
a b c
|
a b c
|
||||||
@ -189,7 +189,7 @@ a b c
|
|||||||
2 -2 -2
|
2 -2 -2
|
||||||
explain select * from t3 where c between -2 and -1 order by a;
|
explain select * from t3 where c between -2 and -1 order by a;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 1 Using where; Using filesort
|
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort
|
||||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol>
|
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol>
|
||||||
select * from t3 where b between -2 and -1 order by b;
|
select * from t3 where b between -2 and -1 order by b;
|
||||||
a b c
|
a b c
|
||||||
@ -205,7 +205,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c between -2 and -1 order by b;
|
explain select * from t3 where c between -2 and -1 order by b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 1 Using where; Using filesort
|
1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort
|
||||||
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol>
|
# SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol>
|
||||||
select * from t3 where b between -2 and -1 order by c;
|
select * from t3 where b between -2 and -1 order by c;
|
||||||
a b c
|
a b c
|
||||||
@ -221,7 +221,7 @@ a b c
|
|||||||
1 -1 -1
|
1 -1 -1
|
||||||
explain select * from t3 where c between -2 and -1 order by c;
|
explain select * from t3 where c between -2 and -1 order by c;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t3 range c c 5 NULL 1 Using where
|
1 SIMPLE t3 range c c 5 NULL 1 Using index condition
|
||||||
# SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol>
|
# SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol>
|
||||||
select sum(b) from t1 group by b;
|
select sum(b) from t1 group by b;
|
||||||
sum(b)
|
sum(b)
|
||||||
|
@ -394,7 +394,7 @@ DROP TABLE t1;
|
|||||||
--echo # LP bug #803851: materialized view + IN->EXISTS
|
--echo # LP bug #803851: materialized view + IN->EXISTS
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
SET SESSION optimizer_switch='semijoin=off,derived_with_keys=on';
|
SET SESSION optimizer_switch='semijoin=off,derived_with_keys=on,materialization=off';
|
||||||
|
|
||||||
CREATE TABLE t1 (a int, b int);
|
CREATE TABLE t1 (a int, b int);
|
||||||
INSERT INTO t1 VALUES (2,2), (3,3), (1,1);
|
INSERT INTO t1 VALUES (2,2), (3,3), (1,1);
|
||||||
@ -895,7 +895,7 @@ INSERT INTO t3 VALUES
|
|||||||
(14,4,'a'), (15,7,'b'), (16,4,'c'), (17,1,'d'), (18,9,'e'),
|
(14,4,'a'), (15,7,'b'), (16,4,'c'), (17,1,'d'), (18,9,'e'),
|
||||||
(19,4,'f'), (20,8,'g');
|
(19,4,'f'), (20,8,'g');
|
||||||
|
|
||||||
SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off';
|
SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off,materialization=off';
|
||||||
|
|
||||||
--echo # The following two EXPLAINs must return the same execution plan
|
--echo # The following two EXPLAINs must return the same execution plan
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
|
312
mysql-test/t/gis-precise.test
Normal file
312
mysql-test/t/gis-precise.test
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
-- source include/have_geometry.inc
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Spatial objects
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))'));
|
||||||
|
select 0, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))'));
|
||||||
|
select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)'));
|
||||||
|
select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
|
||||||
|
select 0, ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
|
||||||
|
select 1, ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))'));
|
||||||
|
|
||||||
|
|
||||||
|
create table t1 (g point);
|
||||||
|
insert into t1 values
|
||||||
|
(GeomFromText('POINT(2 2)')), (GeomFromText('POINT(2 4)')), (GeomFromText('POINT(2 6)')), (GeomFromText('POINT(2 8)')),
|
||||||
|
(GeomFromText('POINT(4 2)')), (GeomFromText('POINT(4 4)')), (GeomFromText('POINT(4 6)')), (GeomFromText('POINT(4 8)')),
|
||||||
|
(GeomFromText('POINT(6 2)')), (GeomFromText('POINT(6 4)')), (GeomFromText('POINT(6 6)')), (GeomFromText('POINT(6 8)')),
|
||||||
|
(GeomFromText('POINT(8 2)')), (GeomFromText('POINT(8 4)')), (GeomFromText('POINT(8 6)')), (GeomFromText('POINT(8 8)'));
|
||||||
|
|
||||||
|
select astext(g) from t1 where ST_Within(g, GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'));
|
||||||
|
select 'Contains';
|
||||||
|
select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
|
||||||
|
select 'Intersects';
|
||||||
|
select astext(g) from t1 where ST_Intersects(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
|
||||||
|
select 'Contains';
|
||||||
|
select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
|
||||||
|
select 'Contains2';
|
||||||
|
select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1), (5.01 3.01, 6 5, 9 5, 8 3, 5.01 3.01))'), g);
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
select 0, ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
|
||||||
|
select 1, ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
|
||||||
|
|
||||||
|
|
||||||
|
select 1, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(50 15, 15 50)'));
|
||||||
|
select 0, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(16 16, 51 51)'));
|
||||||
|
|
||||||
|
select 1, ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'));
|
||||||
|
|
||||||
|
select astext(ST_Union(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')));
|
||||||
|
select astext(ST_Intersection(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')));
|
||||||
|
|
||||||
|
select ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'));
|
||||||
|
select ST_contains(GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)'));
|
||||||
|
select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))'));
|
||||||
|
select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'));
|
||||||
|
select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'));
|
||||||
|
select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))'));
|
||||||
|
|
||||||
|
# Distance tests
|
||||||
|
select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
|
||||||
|
select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('linestring(0 1, 1 0)'));
|
||||||
|
select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
|
||||||
|
select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), geomfromtext('point(3 3)'));
|
||||||
|
select ST_DISTANCE(geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
|
||||||
|
|
||||||
|
|
||||||
|
# Operations tests
|
||||||
|
select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')));
|
||||||
|
select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)')));
|
||||||
|
select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)')));
|
||||||
|
select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)')));
|
||||||
|
select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)')));
|
||||||
|
select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
|
||||||
|
select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
|
||||||
|
|
||||||
|
select astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
|
||||||
|
|
||||||
|
select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
|
||||||
|
select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
|
||||||
|
|
||||||
|
# Buffer() tests
|
||||||
|
select astext(ST_buffer(geometryfromtext('point(1 1)'), 1));
|
||||||
|
create table t1(geom geometrycollection);
|
||||||
|
insert into t1 values (geomfromtext('POLYGON((0 0, 10 10, 0 8, 0 0))'));
|
||||||
|
insert into t1 values (geomfromtext('POLYGON((1 1, 10 10, 0 8, 1 1))'));
|
||||||
|
select astext(geom), area(geom),area(ST_buffer(geom,2)) from t1;
|
||||||
|
select astext(ST_buffer(geom,2)) from t1;
|
||||||
|
|
||||||
|
set @geom=geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)');
|
||||||
|
set @buff=ST_buffer(@geom,1);
|
||||||
|
select astext(@buff);
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#Touches tests
|
||||||
|
select st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)'));
|
||||||
|
select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)'));
|
||||||
|
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)'));
|
||||||
|
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)'));
|
||||||
|
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 2)'));
|
||||||
|
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))'));
|
||||||
|
select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))'));
|
||||||
|
|
||||||
|
#Equals test
|
||||||
|
SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result;
|
||||||
|
SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result;
|
||||||
|
SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result;
|
||||||
|
|
||||||
|
# bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION
|
||||||
|
|
||||||
|
SELECT astext(ST_UNION (
|
||||||
|
PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'),
|
||||||
|
ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))')))));
|
||||||
|
|
||||||
|
#bug 801189 ST_BUFFER asserts if radius = 0
|
||||||
|
SELECT astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0));
|
||||||
|
|
||||||
|
#bug 801199 Infinite recursion in Gcalc_function::count_internal with ST_BUFFER over MULTIPOINT
|
||||||
|
SELECT Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5);
|
||||||
|
|
||||||
|
#bug 801212 Assertion with ST_INTERSECTION on NULL values
|
||||||
|
SELECT ST_INTERSECTION(NULL, NULL);
|
||||||
|
|
||||||
|
#bug 804305 Crash in wkb_get_double with ST_INTERSECTION
|
||||||
|
SELECT ASTEXT(ST_INTERSECTION(
|
||||||
|
MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),
|
||||||
|
((0 5,3 5,3 0,0 0,0 1,2 1,2 2,0 2,0 5), (1 3,2 3,2 4,1 4,1 3)),
|
||||||
|
((2 2,5 2,4 4,2 8,2 2)))'),
|
||||||
|
MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 4,2 5,3 5)),
|
||||||
|
((2 2,9 2,0 2,2 6,2 2)),
|
||||||
|
((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),
|
||||||
|
((9 9,6 8,7 0,9 9)))')));
|
||||||
|
|
||||||
|
#bug 804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection
|
||||||
|
|
||||||
|
SELECT ASTEXT(ST_UNION(
|
||||||
|
MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0),
|
||||||
|
(8 2,1 3,9 0,4 4))'),
|
||||||
|
MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))')));
|
||||||
|
|
||||||
|
SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION(
|
||||||
|
MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 0,4 2,0 2,1 5,0 3,7 0,8 5,5 8),
|
||||||
|
(6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0),
|
||||||
|
(7 8,3 1,0 9,6 0,4 8),
|
||||||
|
(9 3,0 4,5 9,6 4),
|
||||||
|
(8 2,1 3,9 0,4 4))'),
|
||||||
|
MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 0,9 3,2 5,3 6,3 2),
|
||||||
|
(2 5,6 7,9 7,5 2,1 6,3 6))')),
|
||||||
|
MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((7 7,3 7,3 1,7 8,7 7)),
|
||||||
|
((3 5,2 4,2 5,3 5)),
|
||||||
|
((7 7,8 7,3 7,7 7,7 7)),
|
||||||
|
((0 5,3 5,3 4,1 4,1 3,3 3,3 0,0 0,0 5), (1 1,2 1,2 2,1 2,1 1)))'))));
|
||||||
|
|
||||||
|
#bug #805860 Second assertion Assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sinco
|
||||||
|
|
||||||
|
SELECT Round(ST_AREA(ST_BUFFER( ST_UNION(
|
||||||
|
POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'),
|
||||||
|
POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6);
|
||||||
|
|
||||||
|
|
||||||
|
#bug #804259 Second assertion in Gis_geometry_collection::init_from_opresult
|
||||||
|
|
||||||
|
SELECT AsText(ST_UNION(MultiPolygonFromText('
|
||||||
|
MULTIPOLYGON(((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)),
|
||||||
|
((0 0, 8 3, 7 4, 0 0)),
|
||||||
|
((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)))'),
|
||||||
|
MultiPolygonFromText(' MULTIPOLYGON(((0 0, 1 9, 4 6, 0 0)),
|
||||||
|
((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1)),
|
||||||
|
((7 7, 4 7, 6 3, 7 2, 7 7)),
|
||||||
|
((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) ')));
|
||||||
|
|
||||||
|
|
||||||
|
#bug 801217 Assertion `t1->result_range' in Gcalc_operation_reducer::end_couple
|
||||||
|
|
||||||
|
SELECT AsText(ST_SYMDIFFERENCE(
|
||||||
|
MultiLineStringFromText('MULTILINESTRING((7 7, 1 7, 8 5, 7 8, 7 7),
|
||||||
|
(6 3, 3 4, 1 1, 9 9, 9 0, 8 4, 9 9))'),
|
||||||
|
Envelope(GeometryFromText('MULTIPOINT(7 9, 0 0, 3 7, 1 6, 0 0)'))));
|
||||||
|
|
||||||
|
#bug 804266 Memory corruption/valgrind warning/crash in move_hole() with ST_UNION
|
||||||
|
|
||||||
|
SELECT AsText(ST_UNION(
|
||||||
|
MultiPolygonFromText('MULTIPOLYGON(((9 9, 7 9, 1 1, 9 9)),
|
||||||
|
((2 2, 1 2, 3 3, 2 2, 2 2)),
|
||||||
|
((0 0, 7 5, 9 6, 0 0)),
|
||||||
|
((7 7, 5 7, 1 5, 7 1, 7 7)))'),
|
||||||
|
MultiPolygonFromText('MULTIPOLYGON(((2 2, 2 2, 1 5, 2 7, 2 2)),
|
||||||
|
((0 5, 3 5, 3 0, 0 0, 0 5), (1 1, 2 1, 2 4, 1 4, 1 1)))')));
|
||||||
|
|
||||||
|
#bug 802376 ST_INTERSECTION returns wrong result on two overlapping linestrings in maria-5.3-gis
|
||||||
|
|
||||||
|
SELECT AsText( ST_INTERSECTION(
|
||||||
|
LinestringFromText('LINESTRING( 3 5, 2 5, 2 4, 3 4, 3 5 ) ') ,
|
||||||
|
LinestringFromText('LINESTRING( 3 5, 2 4, 2 5, 3 5 ) ')
|
||||||
|
));
|
||||||
|
|
||||||
|
#bug 801560 ST_UNION of adjacent polygons includes extra line in maria-5.3-gis
|
||||||
|
|
||||||
|
SELECT AsText( ST_UNION(
|
||||||
|
PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 7 5 , 2 0 , 2 2 ) ) ') ,
|
||||||
|
PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 3 3 , 2 5 , 2 2 ) ) ') ) );
|
||||||
|
|
||||||
|
#bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis
|
||||||
|
|
||||||
|
SELECT AsText(ST_INTERSECTION(LinestringFromText('LINESTRING(1 1, 2 2)'), GeometryFromText('LINESTRING(3 3, 4 4)')));
|
||||||
|
|
||||||
|
#bug 839341 100% CPU usage with ST_UNION in maria-5.3-gis
|
||||||
|
SELECT AsText(ST_UNION(GEOMETRYFROMTEXT('POINT(8 1)') ,MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 5, 2 5, 2 4, 3 4, 3 5))')));
|
||||||
|
|
||||||
|
#bug 839318 Crash in Gcalc_scan_iterator::point::get_shape with ST_DISTANCE and MULTILINESTRING in maria-5.3-gis
|
||||||
|
SELECT ST_DISTANCE(POINTFROMTEXT('POINT(7 1)'),MULTILINESTRINGFROMTEXT('MULTILINESTRING(
|
||||||
|
(4 7,9 7,6 1,3 4,1 1), (3 5, 2 5, 2 4, 3 4, 3 5))'));
|
||||||
|
|
||||||
|
#bug 839327 Crash in Gcalc_operation_reducer::end_couple with ST_UNION and MULTIPOLYGONs in 5.3-gis
|
||||||
|
SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYGONFROMTEXT('POLYGON((2 2, 7 2, 4 2, 2 0, 2 2))')));
|
||||||
|
|
||||||
|
#bug 841622 Assertion `t->rp->type == Gcalc_function::shape_line' failed in Gcalc_operation_reducer::end_line in maria-5.3-gis
|
||||||
|
|
||||||
|
SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER(ST_UNION(
|
||||||
|
MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 2 5, 7 6, 1 8),(0 0 ,1 6 ,0 1, 8 9, 2 4, 6 1, 3 5, 4 8), (9 3, 5 4, 1 8, 4 2, 5 8, 3 0))' ) ,
|
||||||
|
MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 3 1, 2 7, 4 2, 6 2, 1 5))')
|
||||||
|
), 16)));
|
||||||
|
|
||||||
|
#bug 841625 Assertion `m_poly_borders->next' failed in Gcalc_operation_reducer::count_slice in maria-5.3-gis
|
||||||
|
|
||||||
|
SELECT ST_NUMGEOMETRIES(ST_DIFFERENCE (
|
||||||
|
ST_UNION (
|
||||||
|
MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 2 4 , 5 0 , 2 9 , 6 2 , 0 2 ) , ( 4 3 , 5 6 , 9 4 , 0 7 , 7 2 , 2 0 , 8 2 ) , ( 5 0 , 1 5 , 3 7 , 7 7 ) , ( 2 3 , 9 5 , 2 0 , 8 1 ) , ( 0 9 , 9 3 , 2 8 , 8 1 , 9 4 ) ) ' ),
|
||||||
|
ST_UNION (
|
||||||
|
MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 7 2 , 6 2 , 2 6 , 2 2 ) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) ,
|
||||||
|
ENVELOPE(
|
||||||
|
MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' )
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 2 9 , 1 3 , 7 3 , 8 5 ) , ( 5 0 , 8 1 , 2 0 , 7 4 , 1 0 ) , ( 9 2 , 5 2 , 6 5 , 8 8 , 0 2 ) , ( 0 8 , 3 9 , 4 0 , 1 0 ) , ( 0 0 , 7 6 , 8 3 , 0 0 ) ) ' )
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
#bug 841745 ssertion `!sp0->is_bottom()' failed in Gcalc_scan_iterator::find_intersections in maria-5.3-gis
|
||||||
|
SELECT ASTEXT(ST_DIFFERENCE (
|
||||||
|
POLYGONFROMTEXT( ' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ' ) ,
|
||||||
|
ST_UNION (
|
||||||
|
MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ' ) ,
|
||||||
|
ST_SYMDIFFERENCE (
|
||||||
|
MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 3 8 , 0 8 , 6 6 , 6 1 , 0 5 , 6 7 , 3 7 ) , ( 5 8 , 7 7 , 9 0 , 8 7 ) , ( 1 5 , 1 8 , 2 3 , 3 9 ) , ( 1 3 , 9 7 , 5 5 , 0 8 , 6 9 ) , ( 3 6 , 6 9 , 8 7 , 0 2 , 4 6 , 9 5 ) ) ' ) ,
|
||||||
|
ST_UNION (
|
||||||
|
MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 9 4 , 2 0 , 2 2 , 7 2 , 6 2 ) , ( 5 2 , 8 2 , 4 8 , 3 4 ) , ( 1 0 , 1 4 , 2 7 , 7 0 , 1 5 ) , ( 2 8 , 4 4 , 5 0 , 7 0 , 4 0 ) ) ' ) ,
|
||||||
|
GEOMETRYFROMTEXT( ' MULTILINESTRING( ( 3 7 , 7 3 , 5 8 , 4 8 ) , ( 3 2 , 5 0 , 9 3 , 4 4 ) , ( 6 0 , 4 2 , 7 8 , 1 3 ) ) ' )
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
#bug 841773 Assertion `t0->rp->type == t1->rp->type' failed in Gcalc_operation_reducer::end_couple in maria-5.3-gis
|
||||||
|
SELECT ST_NUMGEOMETRIES(ST_UNION (
|
||||||
|
MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 0 8 , 1 9 , 5 7 , 2 8 , 5 8 , 6 7 ) , ( 4 5 , 8 4 , 0 3 , 5 1 ) , ( 6 8 , 2 7 , 1 6 , 9 9 , 7 2 ) , ( 9 5 , 2 8 , 1 2 , 9 6 , 2 0 ) ) ' ) ,
|
||||||
|
MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 7 7 , 2 7, 6 8, 7 1 , 7 7 ) ) ) ' )
|
||||||
|
));
|
||||||
|
|
||||||
|
#bug 841662 Third assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sincos
|
||||||
|
SELECT ST_BUFFER (
|
||||||
|
LINESTRINGFROMTEXT( ' LINESTRING( 5 4 , 3 8 , 2 6 , 5 5 , 7 9 ) ' ) ,
|
||||||
|
ST_DISTANCE (
|
||||||
|
MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) ,
|
||||||
|
ST_DIFFERENCE (
|
||||||
|
MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) ,
|
||||||
|
MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' )
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) ;
|
||||||
|
SELECT ST_DISTANCE ( ST_DIFFERENCE ( MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) ), MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) ) ;
|
||||||
|
|
||||||
|
#bug 848939 Wrong result with ST_INTERSECTION between linestrings and a polygon in 5.3-gis
|
||||||
|
SELECT ASTEXT(ST_INTERSECTION( GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(7 7,5.33333333333333 7),LINESTRING(5.33333333333333 7,0 7,5 8,5.33333333333333 7),LINESTRING(5.33333333333333 7,7 2,7 7),POLYGON((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5)))'), geomETRYFROMTEXT(' MULTILINESTRING( ( 5 1 , 3 7 , 6 1 , 7 0 ) , ( 1 6 , 8 5 , 7 5 , 5 6 ) )') ));
|
||||||
|
|
||||||
|
#bug 855485 ST_CROSSES returns different result than PostGIS for overlapping polygons
|
||||||
|
|
||||||
|
SELECT ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) '));
|
||||||
|
|
||||||
|
#bug 855487 ST_WITHIN returns wrong result for partially overlapping polygons
|
||||||
|
|
||||||
|
SELECT ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') );
|
||||||
|
|
||||||
|
#bug 855492 ST_WITHIN returns TRUE on point on the edge of a polygon
|
||||||
|
|
||||||
|
SELECT ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) '));
|
||||||
|
|
||||||
|
#bug 855497 ST_ENVELOPE of GEOMETRYCOLLECTION EMPTY returns NULL and not GEOMETRYCOLLECTION EMPTY
|
||||||
|
|
||||||
|
select ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY')));
|
||||||
|
|
||||||
|
#bug 855503 ST_EQUALS reports TRUE between a POLYGON and a MULTILINESTRING
|
||||||
|
|
||||||
|
SELECT ST_EQUALS( GEOMETRYFROMTEXT(' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') , GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') );
|
||||||
|
|
||||||
|
#bug 855505 ST_TOUCHES reports TRUE for intersecting polygon and linestring
|
||||||
|
|
||||||
|
SELECT ST_TOUCHES( GEOMETRYFROMTEXT(' LINESTRING( 1 1 , 1 4 , 5 0 , 8 3 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ') );
|
||||||
|
|
||||||
|
#bug 857051 ST_EQUALS returns TRUE on two nonidentical MULTIPOINTs
|
||||||
|
|
||||||
|
SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT(' MULTIPOINT( 5 8 , 5 2 , 1 8 , 3 0 , 3 0 , 7 8 ) ') );
|
||||||
|
SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT('MULTIPOINT( 4 0 , 6 9 , 5 1, 1 4 )') );
|
||||||
|
|
||||||
|
#bug 857050 ST_WITHIN returns wrong result with MULTIPOINT and POLYGON
|
||||||
|
SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) '));
|
||||||
|
|
||||||
|
#bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs
|
||||||
|
|
||||||
|
SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
|
||||||
|
|
64
mysql-test/t/gis-rt-precise.test
Normal file
64
mysql-test/t/gis-rt-precise.test
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
-- source include/have_geometry.inc
|
||||||
|
|
||||||
|
#
|
||||||
|
# test of rtree (using with spatial data)
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
g GEOMETRY NOT NULL,
|
||||||
|
SPATIAL KEY(g)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
let $1=150;
|
||||||
|
let $2=150;
|
||||||
|
while ($1)
|
||||||
|
{
|
||||||
|
eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
|
||||||
|
dec $1;
|
||||||
|
inc $2;
|
||||||
|
}
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
SELECT count(*) FROM t1;
|
||||||
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 140))'));
|
||||||
|
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
g GEOMETRY NOT NULL
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
let $1=10;
|
||||||
|
while ($1)
|
||||||
|
{
|
||||||
|
let $2=10;
|
||||||
|
while ($2)
|
||||||
|
{
|
||||||
|
eval INSERT INTO t1 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
|
||||||
|
dec $2;
|
||||||
|
}
|
||||||
|
dec $1;
|
||||||
|
}
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
ALTER TABLE t1 ADD SPATIAL KEY(g);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
SELECT count(*) FROM t1;
|
||||||
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
|
||||||
|
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
|
||||||
|
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
|
||||||
|
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo End of 5.5 tests.
|
@ -17,16 +17,12 @@ SHOW CREATE TABLE t1;
|
|||||||
|
|
||||||
let $1=150;
|
let $1=150;
|
||||||
let $2=150;
|
let $2=150;
|
||||||
--disable_query_log
|
|
||||||
begin;
|
|
||||||
while ($1)
|
while ($1)
|
||||||
{
|
{
|
||||||
eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
|
eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
|
||||||
dec $1;
|
dec $1;
|
||||||
inc $2;
|
inc $2;
|
||||||
}
|
}
|
||||||
commit;
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
SELECT count(*) FROM t1;
|
SELECT count(*) FROM t1;
|
||||||
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
|
||||||
@ -39,8 +35,6 @@ CREATE TABLE t2 (
|
|||||||
g GEOMETRY NOT NULL
|
g GEOMETRY NOT NULL
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
--disable_query_log
|
|
||||||
begin;
|
|
||||||
let $1=10;
|
let $1=10;
|
||||||
while ($1)
|
while ($1)
|
||||||
{
|
{
|
||||||
@ -52,8 +46,6 @@ while ($1)
|
|||||||
}
|
}
|
||||||
dec $1;
|
dec $1;
|
||||||
}
|
}
|
||||||
commit;
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
ALTER TABLE t2 ADD SPATIAL KEY(g);
|
ALTER TABLE t2 ADD SPATIAL KEY(g);
|
||||||
SHOW CREATE TABLE t2;
|
SHOW CREATE TABLE t2;
|
||||||
@ -63,8 +55,6 @@ EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
|||||||
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
|
||||||
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||||
|
|
||||||
--disable_query_log
|
|
||||||
begin;
|
|
||||||
let $1=10;
|
let $1=10;
|
||||||
while ($1)
|
while ($1)
|
||||||
{
|
{
|
||||||
@ -77,8 +67,6 @@ while ($1)
|
|||||||
}
|
}
|
||||||
dec $1;
|
dec $1;
|
||||||
}
|
}
|
||||||
commit;
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
|
|
||||||
|
@ -62,7 +62,9 @@ INSERT INTO gis_multi_polygon VALUES
|
|||||||
|
|
||||||
INSERT INTO gis_geometrycollection VALUES
|
INSERT INTO gis_geometrycollection VALUES
|
||||||
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
||||||
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
|
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
|
||||||
|
(122, GeomFromText('GeometryCollection()')),
|
||||||
|
(123, GeomFromText('GeometryCollection EMPTY'));
|
||||||
|
|
||||||
INSERT into gis_geometry SELECT * FROM gis_point;
|
INSERT into gis_geometry SELECT * FROM gis_point;
|
||||||
INSERT into gis_geometry SELECT * FROM gis_line;
|
INSERT into gis_geometry SELECT * FROM gis_line;
|
||||||
@ -538,18 +540,6 @@ create table t1 (g geometry not null);
|
|||||||
insert into t1 values(default);
|
insert into t1 values(default);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
|
||||||
# Bug #27300: create view with geometry functions lost columns types
|
|
||||||
#
|
|
||||||
CREATE TABLE t1 (a GEOMETRY);
|
|
||||||
CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
|
|
||||||
CREATE VIEW v2 AS SELECT a FROM t1;
|
|
||||||
DESCRIBE v1;
|
|
||||||
DESCRIBE v2;
|
|
||||||
|
|
||||||
DROP VIEW v1,v2;
|
|
||||||
DROP TABLE t1;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#24563: MBROverlaps does not seem to function propertly
|
# Bug#24563: MBROverlaps does not seem to function propertly
|
||||||
# Bug#54888: MBROverlaps missing in 5.1?
|
# Bug#54888: MBROverlaps missing in 5.1?
|
||||||
@ -773,14 +763,7 @@ drop table t1;
|
|||||||
#
|
#
|
||||||
# Bug #50574 5.5.x allows spatial indexes on non-spatial
|
# Bug #50574 5.5.x allows spatial indexes on non-spatial
|
||||||
# columns, causing crashes!
|
# columns, causing crashes!
|
||||||
# Bug#11767480 SPATIAL INDEXES ON NON-SPATIAL COLUMNS
|
|
||||||
# CAUSE CRASHES.
|
|
||||||
#
|
#
|
||||||
CREATE TABLE t0 (a BINARY(32) NOT NULL);
|
|
||||||
--error ER_SPATIAL_MUST_HAVE_GEOM_COL
|
|
||||||
CREATE SPATIAL INDEX i on t0 (a);
|
|
||||||
INSERT INTO t0 VALUES (1);
|
|
||||||
|
|
||||||
--error ER_SPATIAL_MUST_HAVE_GEOM_COL
|
--error ER_SPATIAL_MUST_HAVE_GEOM_COL
|
||||||
CREATE TABLE t1(
|
CREATE TABLE t1(
|
||||||
col0 BINARY NOT NULL,
|
col0 BINARY NOT NULL,
|
||||||
@ -818,7 +801,542 @@ CREATE TABLE t3 (
|
|||||||
);
|
);
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
DROP TABLE t0, t1, t2;
|
DROP TABLE t1;
|
||||||
|
DROP TABLE t2;
|
||||||
|
|
||||||
|
#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
|
||||||
|
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
|
||||||
|
|
||||||
|
#bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs
|
||||||
|
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
|
||||||
|
|
||||||
|
|
||||||
|
# Conformance tests
|
||||||
|
#
|
||||||
|
# C.3.3 Geometry types and functions
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP DATABASE IF EXISTS gis_ogs;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE DATABASE gis_ogs;
|
||||||
|
USE gis_ogs;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # C.3.3.1 Geometry types and functions schema construction
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#CREATE TABLE spatial_ref_sys (
|
||||||
|
#srid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
#auth_name CHARACTER VARYING,
|
||||||
|
#auth_srid INTEGER,
|
||||||
|
#srtext CHARACTER VARYING(2048));
|
||||||
|
|
||||||
|
CREATE TABLE lakes (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
shore POLYGON);
|
||||||
|
|
||||||
|
CREATE TABLE road_segments (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
aliases CHARACTER VARYING(64),
|
||||||
|
num_lanes INTEGER,
|
||||||
|
centerline LINESTRING);
|
||||||
|
|
||||||
|
CREATE TABLE divided_routes (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
num_lanes INTEGER,
|
||||||
|
centerlines MULTILINESTRING);
|
||||||
|
|
||||||
|
CREATE TABLE forests (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
boundary MULTIPOLYGON);
|
||||||
|
|
||||||
|
CREATE TABLE bridges (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
position POINT);
|
||||||
|
|
||||||
|
CREATE TABLE streams (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
centerline LINESTRING);
|
||||||
|
|
||||||
|
CREATE TABLE buildings (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
address CHARACTER VARYING(64),
|
||||||
|
position POINT,
|
||||||
|
footprint POLYGON);
|
||||||
|
|
||||||
|
CREATE TABLE ponds (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
type CHARACTER VARYING(64),
|
||||||
|
shores MULTIPOLYGON);
|
||||||
|
|
||||||
|
CREATE TABLE named_places (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
name CHARACTER VARYING(64),
|
||||||
|
boundary POLYGON);
|
||||||
|
|
||||||
|
CREATE TABLE map_neatlines (
|
||||||
|
fid INTEGER NOT NULL PRIMARY KEY,
|
||||||
|
neatline POLYGON);
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # C.3.3.2 Geometry types and functions schema data loading
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#-- Spatial Reference System
|
||||||
|
#INSERT INTO spatial_ref_sys VALUES
|
||||||
|
#(101, 'POSC', 32214, 'PROJCS["UTM_ZONE_14N",
|
||||||
|
#GEOGCS["World Geodetic System 72",
|
||||||
|
#DATUM["WGS_72",
|
||||||
|
#ELLIPSOID["NWL_10D", 6378135, 298.26]],
|
||||||
|
#PRIMEM["Greenwich", 0],
|
||||||
|
#UNIT["Meter", 1.0]],
|
||||||
|
#PROJECTION["Transverse_Mercator"],
|
||||||
|
#PARAMETER["False_Easting", 500000.0],
|
||||||
|
#PARAMETER["False_Northing", 0.0],
|
||||||
|
#PARAMETER["Central_Meridian", -99.0],
|
||||||
|
#PARAMETER["Scale_Factor", 0.9996],
|
||||||
|
#PARAMETER["Latitude_of_origin", 0.0],
|
||||||
|
#UNIT["Meter", 1.0]]');
|
||||||
|
|
||||||
|
--echo # Lakes
|
||||||
|
INSERT INTO lakes VALUES (
|
||||||
|
101, 'BLUE LAKE',
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON(
|
||||||
|
(52 18,66 23,73 9,48 6,52 18),
|
||||||
|
(59 18,67 18,67 13,59 13,59 18)
|
||||||
|
)',
|
||||||
|
101));
|
||||||
|
|
||||||
|
|
||||||
|
--echo # Road Segments
|
||||||
|
|
||||||
|
INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
|
||||||
|
|
||||||
|
INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
|
||||||
|
|
||||||
|
INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 70 38, 72 48 )' ,101));
|
||||||
|
|
||||||
|
INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 70 38, 84 42 )' ,101));
|
||||||
|
|
||||||
|
INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
|
||||||
|
1,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 28 26, 28 0 )',101));
|
||||||
|
|
||||||
|
--echo # DividedRoutes
|
||||||
|
|
||||||
|
INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
|
||||||
|
MLineFromText(
|
||||||
|
'MULTILINESTRING((10 48,10 21,10 0),
|
||||||
|
(16 0,16 23,16 48))', 101));
|
||||||
|
|
||||||
|
--echo # Forests
|
||||||
|
|
||||||
|
INSERT INTO forests VALUES(109, 'Green Forest',
|
||||||
|
MPolyFromText(
|
||||||
|
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
|
||||||
|
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
|
||||||
|
101));
|
||||||
|
|
||||||
|
--echo # Bridges
|
||||||
|
|
||||||
|
INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
|
||||||
|
'POINT( 44 31 )', 101));
|
||||||
|
|
||||||
|
--echo # Streams
|
||||||
|
|
||||||
|
INSERT INTO streams VALUES(111, 'Cam Stream',
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
|
||||||
|
|
||||||
|
INSERT INTO streams VALUES(112, NULL,
|
||||||
|
LineFromText(
|
||||||
|
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
|
||||||
|
|
||||||
|
--echo # Buildings
|
||||||
|
|
||||||
|
INSERT INTO buildings VALUES(113, '123 Main Street',
|
||||||
|
PointFromText(
|
||||||
|
'POINT( 52 30 )', 101),
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
|
||||||
|
|
||||||
|
INSERT INTO buildings VALUES(114, '215 Main Street',
|
||||||
|
PointFromText(
|
||||||
|
'POINT( 64 33 )', 101),
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
|
||||||
|
|
||||||
|
|
||||||
|
--echo # Ponds
|
||||||
|
|
||||||
|
INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
|
||||||
|
MPolyFromText(
|
||||||
|
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
|
||||||
|
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
|
||||||
|
|
||||||
|
--echo # Named Places
|
||||||
|
|
||||||
|
INSERT INTO named_places VALUES(117, 'Ashton',
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
|
||||||
|
|
||||||
|
INSERT INTO named_places VALUES(118, 'Goose Island',
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
|
||||||
|
|
||||||
|
--echo # Map Neatlines
|
||||||
|
|
||||||
|
INSERT INTO map_neatlines VALUES(115,
|
||||||
|
PolyFromText(
|
||||||
|
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # C.3.3.3 Geometry types and functions schema test queries
|
||||||
|
--echo
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T1
|
||||||
|
#SELECT f_table_name
|
||||||
|
#FROM geometry_columns;
|
||||||
|
#
|
||||||
|
#--echo # Conformance Item T2
|
||||||
|
#SELECT f_geometry_column
|
||||||
|
#FROM geometry_columns
|
||||||
|
#WHERE f_table_name = 'streams';
|
||||||
|
#
|
||||||
|
#--echo # Conformance Item T3
|
||||||
|
#SELECT coord_dimension
|
||||||
|
#FROM geometry_columns
|
||||||
|
#WHERE f_table_name = 'streams';
|
||||||
|
#
|
||||||
|
#--echo # Conformance Item T4
|
||||||
|
#
|
||||||
|
#SELECT srid
|
||||||
|
#FROM geometry_columns
|
||||||
|
#WHERE f_table_name = 'streams';
|
||||||
|
#
|
||||||
|
#--echo # Conformance Item T5
|
||||||
|
#
|
||||||
|
#SELECT srtext
|
||||||
|
#FROM SPATIAL_REF_SYS
|
||||||
|
#WHERE SRID = 101;
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
--echo # Conformance Item T6
|
||||||
|
# TODO: ST_Dimension() alias
|
||||||
|
SELECT Dimension(shore)
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
|
||||||
|
--echo # Conformance Item T7
|
||||||
|
# TODO: ST_GeometryType() alias
|
||||||
|
SELECT GeometryType(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
|
||||||
|
--echo # Conformance Item T8
|
||||||
|
# TODO: ST_AsText() alias
|
||||||
|
SELECT AsText(boundary)
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T9
|
||||||
|
# TODO: ST_AsBinary(), ST_PolyFromWKB() aliases
|
||||||
|
SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T10
|
||||||
|
# TODO: ST_SRID() alias
|
||||||
|
SELECT SRID(boundary)
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T11
|
||||||
|
# TODO: ST_IsEmpty() alias
|
||||||
|
SELECT IsEmpty(centerline)
|
||||||
|
FROM road_segments
|
||||||
|
WHERE name = 'Route 5'
|
||||||
|
AND aliases = 'Main Street';
|
||||||
|
|
||||||
|
# FIXME: get wrong result:0, expected 1.
|
||||||
|
#--echo # Conformance Item T12
|
||||||
|
# TODO: ST_IsSimple() alias
|
||||||
|
#SELECT IsSimple(shore)
|
||||||
|
#FROM lakes
|
||||||
|
#WHERE name = 'Blue Lake';
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T13
|
||||||
|
#SELECT AsText(Boundary((boundary),101)
|
||||||
|
#FROM named_places
|
||||||
|
#WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T14
|
||||||
|
# TODO: ST_Envelope( ) alias
|
||||||
|
# FIXME: we get anticlockwise, GIS suggests clockwise
|
||||||
|
SELECT AsText(Envelope(boundary))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T15
|
||||||
|
# TODO: ST_X() alias
|
||||||
|
SELECT X(position)
|
||||||
|
FROM bridges
|
||||||
|
WHERE name = 'Cam Bridge';
|
||||||
|
|
||||||
|
--echo # Conformance Item T16
|
||||||
|
# TODO: ST_Y() alias
|
||||||
|
SELECT Y(position)
|
||||||
|
FROM bridges
|
||||||
|
WHERE name = 'Cam Bridge';
|
||||||
|
|
||||||
|
--echo # Conformance Item T17
|
||||||
|
# TODO: ST_StartPoint() alias
|
||||||
|
SELECT AsText(StartPoint(centerline))
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
|
||||||
|
--echo # Conformance Item T18
|
||||||
|
# TODO: ST_EndPoint
|
||||||
|
SELECT AsText(EndPoint(centerline))
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T19
|
||||||
|
# TODO: ST_LineFromWKB() alias
|
||||||
|
#SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
|
||||||
|
#FROM named_places
|
||||||
|
#WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T20
|
||||||
|
#SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
|
||||||
|
#FROM named_places
|
||||||
|
#WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T21
|
||||||
|
# TODO: ST_Length() alias
|
||||||
|
SELECT GLength(centerline)
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 106;
|
||||||
|
|
||||||
|
--echo # Conformance Item T22
|
||||||
|
# TODO: ST_NumPoints() alias
|
||||||
|
SELECT NumPoints(centerline)
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
|
||||||
|
--echo # Conformance Item T23
|
||||||
|
# TODO: ST_PointN() alias
|
||||||
|
SELECT AsText(PointN(centerline, 1))
|
||||||
|
FROM road_segments
|
||||||
|
WHERE fid = 102;
|
||||||
|
|
||||||
|
--echo # Conformance Item T24
|
||||||
|
# TODO: ST_Centroid() alias
|
||||||
|
SELECT AsText(Centroid(boundary))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T25
|
||||||
|
#SELECT Contains(boundary, PointOnSurface(boundary))
|
||||||
|
#FROM named_places
|
||||||
|
#WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T26
|
||||||
|
# TODO: ST_Area() alias
|
||||||
|
SELECT Area(boundary)
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T27
|
||||||
|
# TODO: ST_ExteriorRing() alias
|
||||||
|
SELECT AsText(ExteriorRing(shore))
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
|
||||||
|
--echo # Conformance Item T28
|
||||||
|
# TODO: ST_NumInteriorRings() alias
|
||||||
|
SELECT NumInteriorRings(shore)
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
|
||||||
|
--echo # Conformance Item T29
|
||||||
|
# TODO: ST_InteriorRingN() alias
|
||||||
|
SELECT AsText(InteriorRingN(shore, 1))
|
||||||
|
FROM lakes
|
||||||
|
WHERE name = 'Blue Lake';
|
||||||
|
|
||||||
|
--echo # Conformance Item T30
|
||||||
|
# TODO: ST_NumGeometries() alias
|
||||||
|
SELECT NumGeometries(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
|
||||||
|
--echo # Conformance Item T31
|
||||||
|
# TODO: ST_GeometryN() alias
|
||||||
|
SELECT AsText(GeometryN(centerlines, 2))
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
|
||||||
|
--echo # Conformance Item T32
|
||||||
|
# TODO: ST_IsClosed() alias
|
||||||
|
SELECT IsClosed(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
|
||||||
|
--echo # Conformance Item T33
|
||||||
|
# TODO: ST_Length() alias
|
||||||
|
SELECT GLength(centerlines)
|
||||||
|
FROM divided_routes
|
||||||
|
WHERE name = 'Route 75';
|
||||||
|
|
||||||
|
--echo # Conformance Item T34
|
||||||
|
# TODO: ST_Centroid() alias
|
||||||
|
SELECT AsText(Centroid(shores))
|
||||||
|
FROM ponds
|
||||||
|
WHERE fid = 120;
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T35
|
||||||
|
#SELECT Contains(shores, PointOnSurface(shores))
|
||||||
|
#FROM ponds
|
||||||
|
#WHERE fid = 120;
|
||||||
|
|
||||||
|
--echo # Conformance Item T36
|
||||||
|
# TODO: ST_Area() alias
|
||||||
|
SELECT Area(shores)
|
||||||
|
FROM ponds
|
||||||
|
WHERE fid = 120;
|
||||||
|
|
||||||
|
--echo # Conformance Item T37
|
||||||
|
# TODO: ST_PolyFromText() alias
|
||||||
|
SELECT ST_Equals(boundary,
|
||||||
|
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
|
||||||
|
FROM named_places
|
||||||
|
WHERE name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T38
|
||||||
|
SELECT ST_Disjoint(centerlines, boundary)
|
||||||
|
FROM divided_routes, named_places
|
||||||
|
WHERE divided_routes.name = 'Route 75'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
|
||||||
|
--echo # Conformance Item T39
|
||||||
|
SELECT ST_Touches(centerline, shore)
|
||||||
|
FROM streams, lakes
|
||||||
|
WHERE streams.name = 'Cam Stream'
|
||||||
|
AND lakes.name = 'Blue Lake';
|
||||||
|
|
||||||
|
# FIXME: wrong result: get 0, expected 1
|
||||||
|
#--echo # Conformance Item T40
|
||||||
|
#SELECT ST_Within(boundary, footprint)
|
||||||
|
#FROM named_places, buildings
|
||||||
|
#WHERE named_places.name = 'Ashton'
|
||||||
|
#AND buildings.address = '215 Main Street';
|
||||||
|
|
||||||
|
# FIXME: wrong result: get 0, expected 1
|
||||||
|
#--echo # Conformance Item T41
|
||||||
|
#SELECT ST_Overlaps(forests.boundary, named_places.boundary)
|
||||||
|
#FROM forests, named_places
|
||||||
|
#WHERE forests.name = 'Green Forest'
|
||||||
|
#AND named_places.name = 'Ashton';
|
||||||
|
|
||||||
|
--echo # Conformance Item T42
|
||||||
|
# FIXME: TODO: ST_Crosses() alias
|
||||||
|
SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
|
||||||
|
FROM road_segments, divided_routes
|
||||||
|
WHERE road_segments.fid = 102
|
||||||
|
AND divided_routes.name = 'Route 75';
|
||||||
|
|
||||||
|
--echo # Conformance Item T43
|
||||||
|
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
|
||||||
|
FROM road_segments, divided_routes
|
||||||
|
WHERE road_segments.fid = 102
|
||||||
|
AND divided_routes.name = 'Route 75';
|
||||||
|
|
||||||
|
--echo # Conformance Item T44
|
||||||
|
SELECT ST_Contains(forests.boundary, named_places.boundary)
|
||||||
|
FROM forests, named_places
|
||||||
|
WHERE forests.name = 'Green Forest'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T45
|
||||||
|
#SELECT Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
|
||||||
|
#FROM forests, named_places
|
||||||
|
#WHERE forests.name = 'Green Forest'
|
||||||
|
#AND named_places.name = 'Ashton';
|
||||||
|
|
||||||
|
--echo # Conformance Item T46
|
||||||
|
SELECT ST_Distance(position, boundary)
|
||||||
|
FROM bridges, named_places
|
||||||
|
WHERE bridges.name = 'Cam Bridge'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
|
||||||
|
# FIXME: wrong result: NULL, expected 12
|
||||||
|
#--echo # Conformance Item T47
|
||||||
|
#SELECT AsText(ST_Intersection(centerline, shore))
|
||||||
|
#FROM streams, lakes
|
||||||
|
#WHERE streams.name = 'Cam Stream'
|
||||||
|
#AND lakes.name = 'Blue Lake';
|
||||||
|
|
||||||
|
--echo # Conformance Item T48
|
||||||
|
SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
|
||||||
|
FROM named_places, forests
|
||||||
|
WHERE named_places.name = 'Ashton'
|
||||||
|
AND forests.name = 'Green Forest';
|
||||||
|
|
||||||
|
#--echo # Conformance Item T49
|
||||||
|
SELECT AsText(ST_Union(shore, boundary))
|
||||||
|
FROM lakes, named_places
|
||||||
|
WHERE lakes.name = 'Blue Lake'
|
||||||
|
AND named_places.name = 'Goose Island';
|
||||||
|
|
||||||
|
--echo # Conformance Item T50
|
||||||
|
SELECT AsText(ST_SymDifference(shore, boundary))
|
||||||
|
FROM lakes, named_places
|
||||||
|
WHERE lakes.name = 'Blue Lake'
|
||||||
|
AND named_places.name = 'Ashton';
|
||||||
|
|
||||||
|
--echo # Conformance Item T51
|
||||||
|
SELECT count(*)
|
||||||
|
FROM buildings, bridges
|
||||||
|
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
|
||||||
|
|
||||||
|
# TODO: WL#2377
|
||||||
|
#--echo # Conformance Item T52
|
||||||
|
#SELECT AsText(ConvexHull(shore))
|
||||||
|
#FROM lakes
|
||||||
|
#WHERE lakes.name = 'Blue Lake';
|
||||||
|
|
||||||
|
DROP DATABASE gis_ogs;
|
||||||
|
USE test;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
|
--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
|
||||||
@ -838,5 +1356,5 @@ FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month)
|
|||||||
|
|
||||||
DROP TABLE g1;
|
DROP TABLE g1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.5 tests
|
--echo End of 5.5 tests
|
||||||
|
|
||||||
|
@ -3379,3 +3379,31 @@ execute stmt using @a;
|
|||||||
set @a='2010-08-08';
|
set @a='2010-08-08';
|
||||||
execute stmt using @a;
|
execute stmt using @a;
|
||||||
execute stmt using @a;
|
execute stmt using @a;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #892725: look-up is changed for a full scan when executing PS
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (a int primary key, b int);
|
||||||
|
insert into t1 values
|
||||||
|
(7,70), (3,40), (4,40), (8,70), (1,70), (9,50), (2,70);
|
||||||
|
|
||||||
|
prepare st from 'select * from t1 where a=8';
|
||||||
|
|
||||||
|
flush status;
|
||||||
|
execute st;
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
flush status;
|
||||||
|
execute st;
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
flush status;
|
||||||
|
select * from t1 use index() where a=3;
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
flush status;
|
||||||
|
execute st;
|
||||||
|
show status like '%Handler_read%';
|
||||||
|
|
||||||
|
deallocate prepare st;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
@ -1030,9 +1030,8 @@ SELECT * FROM t1,t2,t3
|
|||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
#
|
#
|
||||||
# LP bug #823301: index merge union with prossible index scan
|
# LP bug #823301: index merge sort union with possible index scan
|
||||||
#
|
#
|
||||||
#
|
|
||||||
|
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
a int, b int, c int, d int,
|
a int, b int, c int, d int,
|
||||||
@ -1058,5 +1057,38 @@ SET SESSION optimizer_switch=DEFAULT;
|
|||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# LP bug #800184: possible index merge sort union
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int NOT NULL PRIMARY KEY, b int, c int, INDEX idx(c,b));
|
||||||
|
INSERT INTO t1 VALUES (19,1,NULL), (20,5,7);
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||||
|
(t1.c=0 OR t1.a=500);
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||||
|
(t1.c=0 OR t1.a=500);
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# LP bug #891953: always true OR
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX idx(b));
|
||||||
|
INSERT INTO t1 VALUES (167,9999), (168,10000);
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
#the following command must be the last one in the file
|
#the following command must be the last one in the file
|
||||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||||
|
|
||||||
|
@ -5063,4 +5063,14 @@ SET SESSION sql_mode=@old_sql_mode;
|
|||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # LP BUG#833777 Performance regression with deeply nested subqueries
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (a int not null, b char(10) not null);
|
||||||
|
insert into t1 values (1, 'a');
|
||||||
|
set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
|
||||||
|
select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
set optimizer_switch=@subselect_tmp;
|
set optimizer_switch=@subselect_tmp;
|
||||||
|
@ -872,12 +872,17 @@ create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) orde
|
|||||||
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
|
create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
|
||||||
create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
|
create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
|
||||||
|
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
|
|
||||||
update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
update t22 set c = '2005-12-08 15:58:27' where a = 255;
|
||||||
explain select t21.* from t21,t22 where t21.a = t22.a and
|
explain select t21.* from t21,t22 where t21.a = t22.a and
|
||||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||||
select t21.* from t21,t22 where t21.a = t22.a and
|
select t21.* from t21,t22 where t21.a = t22.a and
|
||||||
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
|
||||||
|
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
drop table t1, t11, t12, t21, t22;
|
drop table t1, t11, t12, t21, t22;
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -888,7 +893,7 @@ drop table t1, t11, t12, t21, t22;
|
|||||||
create table t1(a int);
|
create table t1(a int);
|
||||||
insert into t1 values (0),(1);
|
insert into t1 values (0),(1);
|
||||||
|
|
||||||
set @@optimizer_switch='firstmatch=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
explain
|
explain
|
||||||
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
||||||
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
|
||||||
@ -914,6 +919,9 @@ select * from t1 where 2 in (select a from t0);
|
|||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
|
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
|
|
||||||
#
|
#
|
||||||
# FirstMatch referring to a derived table
|
# FirstMatch referring to a derived table
|
||||||
#
|
#
|
||||||
@ -943,6 +951,8 @@ and t4.pk=t1.c);
|
|||||||
|
|
||||||
drop table t1, t3, t4;
|
drop table t1, t3, t4;
|
||||||
|
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test if we handle duplicate elimination temptable overflowing to disk
|
# Test if we handle duplicate elimination temptable overflowing to disk
|
||||||
#
|
#
|
||||||
@ -997,6 +1007,9 @@ explain select * from t1 where a in (select a from t1);
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
|
|
||||||
#
|
#
|
||||||
# SJ-Materialization-scan for non-first table
|
# SJ-Materialization-scan for non-first table
|
||||||
#
|
#
|
||||||
@ -1040,6 +1053,8 @@ explain select * from t2 where (b,a) in (select a,b from t1 where a=3);
|
|||||||
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Multi-column sj-materialization with lookups
|
# Multi-column sj-materialization with lookups
|
||||||
#
|
#
|
||||||
@ -1048,7 +1063,7 @@ insert into t1 select a,a from t0;
|
|||||||
create table t2 (a int, b int);
|
create table t2 (a int, b int);
|
||||||
insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B;
|
insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B;
|
||||||
|
|
||||||
set @@optimizer_switch='firstmatch=off';
|
set @@optimizer_switch='firstmatch=off,materialization=off';
|
||||||
explain select * from t1 where (a,b) in (select a,b from t2);
|
explain select * from t1 where (a,b) in (select a,b from t2);
|
||||||
|
|
||||||
# A smallish test if find_best() still works for semi-join optimization:
|
# A smallish test if find_best() still works for semi-join optimization:
|
||||||
@ -1060,6 +1075,7 @@ set @@optimizer_switch=@save_optimizer_switch;
|
|||||||
|
|
||||||
drop table t0, t1, t2;
|
drop table t0, t1, t2;
|
||||||
|
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
|
|
||||||
#
|
#
|
||||||
# Primitive SJ-Materialization tests for DECIMAL and DATE
|
# Primitive SJ-Materialization tests for DECIMAL and DATE
|
||||||
@ -1094,6 +1110,8 @@ explain select * from t1 where (a,b,c) in (select X.a, Y.a, Z.a from t2 X, t2 Y,
|
|||||||
|
|
||||||
drop table t0,t1,t2;
|
drop table t0,t1,t2;
|
||||||
|
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
--echo
|
--echo
|
||||||
--echo BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
|
--echo BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
|
||||||
--echo
|
--echo
|
||||||
@ -1150,12 +1168,15 @@ create table t3 (
|
|||||||
insert into t3 values (1,1, 'foo'), (2,2,'bar');
|
insert into t3 values (1,1, 'foo'), (2,2,'bar');
|
||||||
|
|
||||||
--echo The following must be converted to a semi-join:
|
--echo The following must be converted to a semi-join:
|
||||||
|
set @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
set @@optimizer_switch='materialization=off';
|
||||||
explain extended SELECT a.idIndividual FROM t1 a
|
explain extended SELECT a.idIndividual FROM t1 a
|
||||||
WHERE a.idIndividual IN
|
WHERE a.idIndividual IN
|
||||||
( SELECT c.idObj FROM t3 cona
|
( SELECT c.idObj FROM t3 cona
|
||||||
INNER JOIN t2 c ON c.idContact=cona.idContact
|
INNER JOIN t2 c ON c.idContact=cona.idContact
|
||||||
WHERE cona.postalStripped='T2H3B2'
|
WHERE cona.postalStripped='T2H3B2'
|
||||||
);
|
);
|
||||||
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -126,6 +126,9 @@ INSERT INTO t4 VALUES (1), (2), (3);
|
|||||||
CREATE TABLE t5 ( a INT );
|
CREATE TABLE t5 ( a INT );
|
||||||
INSERT INTO t5 VALUES (NULL), (2);
|
INSERT INTO t5 VALUES (NULL), (2);
|
||||||
|
|
||||||
|
SET @old_optimizer_switch = @@session.optimizer_switch;
|
||||||
|
SET SESSION optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
|
||||||
|
|
||||||
--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
|
--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
|
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
|
||||||
@ -167,6 +170,8 @@ SELECT * FROM t1 WHERE b NOT IN ( SELECT c FROM t2 WHERE c = 1 );
|
|||||||
|
|
||||||
SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 );
|
SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 );
|
||||||
|
|
||||||
|
SET SESSION optimizer_switch = @old_optimizer_switch;
|
||||||
|
|
||||||
DROP TABLE t1, t2, t3, t4, t5;
|
DROP TABLE t1, t2, t3, t4, t5;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -323,7 +323,7 @@ create index key1 on t2 (kp1, kp2);
|
|||||||
create index key2 on t2 (kp1);
|
create index key2 on t2 (kp1);
|
||||||
create index key3 on t2 (kp2);
|
create index key3 on t2 (kp2);
|
||||||
|
|
||||||
set session optimizer_switch='default';
|
SET @@optimizer_switch='materialization=off,semijoin=off,in_to_exists=on';
|
||||||
|
|
||||||
analyze table t2;
|
analyze table t2;
|
||||||
|
|
||||||
@ -331,6 +331,8 @@ explain
|
|||||||
select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
|
select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
|
||||||
select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
|
select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
|
||||||
|
|
||||||
|
set @@optimizer_switch='default';
|
||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -1880,5 +1880,35 @@ set optimizer_switch= @tmp_otimizer_switch;
|
|||||||
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #887496: semijoin with IN equality for the second part of an index
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
INSERT INTO t1 VALUES (9), (0), (8), (5);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (a int, b varchar(1), INDEX idx (b,a));
|
||||||
|
INSERT INTO t2 VALUES (5,'r'), (5,'z');
|
||||||
|
|
||||||
|
CREATE TABLE t3 (a int, b varchar(1), INDEX idx (b,a));
|
||||||
|
INSERT INTO t3 VALUES (5,'r'), (5,'z');
|
||||||
|
|
||||||
|
set @tmp_otimizer_switch= @@optimizer_switch;
|
||||||
|
SET SESSION optimizer_switch='semijoin=on,firstmatch=on';
|
||||||
|
|
||||||
|
SET SESSION optimizer_switch='loosescan=off';
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
|
||||||
|
SET SESSION optimizer_switch='loosescan=on';
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
|
||||||
|
|
||||||
|
set optimizer_switch= @tmp_otimizer_switch;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
# The following command must be the last one the file
|
# The following command must be the last one the file
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
|
@ -43,6 +43,48 @@ SELECT * FROM t0 WHERE t0.a IN
|
|||||||
set optimizer_switch=@save_optimizer_switch;
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
drop table t0, t1, t2;
|
drop table t0, t1, t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #891995: IN subquery with join_cache_level >= 3
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a varchar(1));
|
||||||
|
INSERT INTO t1 VALUES ('w'),('q');
|
||||||
|
|
||||||
|
CREATE TABLE t2 (a int NOT NULL, b time, PRIMARY KEY (a));
|
||||||
|
INSERT INTO t2 VALUES
|
||||||
|
(2,'18:56:33'), (5,'19:11:10'), (3,'18:56:33'), (7,'19:11:10');
|
||||||
|
|
||||||
|
CREATE TABLE t3 (
|
||||||
|
a int NOT NULL, b int, c int, d varchar(1), PRIMARY KEY (a), KEY (d,c)
|
||||||
|
);
|
||||||
|
INSERT INTO t3 VALUES
|
||||||
|
(25,158,10,'f'), (26,5,2,'v'), (27,163,103,'f'), (28,2,3,'q'), (29,8,6,'y');
|
||||||
|
|
||||||
|
set @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
SET SESSION optimizer_switch='semijoin=on';
|
||||||
|
|
||||||
|
SET SESSION optimizer_switch='join_cache_hashed=on';
|
||||||
|
SET SESSION join_cache_level=3;
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
|
||||||
|
|
||||||
|
SET SESSION optimizer_switch='mrr=on';
|
||||||
|
SET SESSION join_cache_level=6;
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
SELECT * FROM t1, t2
|
||||||
|
WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
|
||||||
|
|
||||||
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
|
set join_cache_level=default;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
--echo # End
|
--echo # End
|
||||||
|
|
||||||
set join_cache_level=default;
|
set join_cache_level=default;
|
||||||
|
@ -81,6 +81,7 @@ SET (SQL_SOURCE
|
|||||||
create_options.cc multi_range_read.cc
|
create_options.cc multi_range_read.cc
|
||||||
opt_index_cond_pushdown.cc opt_subselect.cc
|
opt_index_cond_pushdown.cc opt_subselect.cc
|
||||||
opt_table_elimination.cc sql_expression_cache.cc
|
opt_table_elimination.cc sql_expression_cache.cc
|
||||||
|
gcalc_slicescan.cc gcalc_tools.cc
|
||||||
|
|
||||||
${GEN_SOURCES}
|
${GEN_SOURCES}
|
||||||
${MYSYS_LIBWRAP_SOURCE})
|
${MYSYS_LIBWRAP_SOURCE})
|
||||||
|
@ -7524,7 +7524,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
|
|||||||
goto err;
|
goto err;
|
||||||
// Check given WKB
|
// Check given WKB
|
||||||
uint32 wkb_type;
|
uint32 wkb_type;
|
||||||
if (length < SRID_SIZE + WKB_HEADER_SIZE + SIZEOF_STORED_DOUBLE*2)
|
if (length < SRID_SIZE + WKB_HEADER_SIZE + 4)
|
||||||
goto err;
|
goto err;
|
||||||
wkb_type= uint4korr(from + SRID_SIZE + 1);
|
wkb_type= uint4korr(from + SRID_SIZE + 1);
|
||||||
if (wkb_type < (uint32) Geometry::wkb_point ||
|
if (wkb_type < (uint32) Geometry::wkb_point ||
|
||||||
|
1966
sql/gcalc_slicescan.cc
Normal file
1966
sql/gcalc_slicescan.cc
Normal file
File diff suppressed because it is too large
Load Diff
595
sql/gcalc_slicescan.h
Normal file
595
sql/gcalc_slicescan.h
Normal file
@ -0,0 +1,595 @@
|
|||||||
|
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
|
||||||
|
Copyright (C) 2011 Monty Program Ab.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GCALC_SLICESCAN_INCLUDED
|
||||||
|
#define GCALC_SLICESCAN_INCLUDED
|
||||||
|
|
||||||
|
#ifndef DBUG_OFF
|
||||||
|
// #define GCALC_CHECK_WITH_FLOAT
|
||||||
|
#else
|
||||||
|
#define GCALC_DBUG_OFF
|
||||||
|
#endif /*DBUG_OFF*/
|
||||||
|
|
||||||
|
#ifndef GCALC_DBUG_OFF
|
||||||
|
#define GCALC_DBUG_PRINT(b) DBUG_PRINT("Gcalc", b)
|
||||||
|
#define GCALC_DBUG_ENTER(a) DBUG_ENTER("Gcalc "a)
|
||||||
|
#define GCALC_DBUG_RETURN(r) DBUG_RETURN(r)
|
||||||
|
#define GCALC_DBUG_VOID_RETURN DBUG_VOID_RETURN
|
||||||
|
#define GCALC_DBUG_ASSERT(r) DBUG_ASSERT(r)
|
||||||
|
#else
|
||||||
|
#define GCALC_DBUG_PRINT(b) do {} while(0)
|
||||||
|
#define GCALC_DBUG_ENTER(a) do {} while(0)
|
||||||
|
#define GCALC_DBUG_RETURN(r) return (r)
|
||||||
|
#define GCALC_DBUG_VOID_RETURN do {} while(0)
|
||||||
|
#define GCALC_DBUG_ASSERT(r) do {} while(0)
|
||||||
|
#endif /*GCALC_DBUG_OFF*/
|
||||||
|
|
||||||
|
#define GCALC_TERMINATED(state_var) (state_var && (*state_var))
|
||||||
|
#define GCALC_SET_TERMINATED(state_var, val) state_var= val
|
||||||
|
#define GCALC_DECL_TERMINATED_STATE(varname) \
|
||||||
|
volatile int *varname;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gcalc_dyn_list class designed to manage long lists of same-size objects
|
||||||
|
with the possible efficiency.
|
||||||
|
It allocates fixed-size blocks of memory (blk_size specified at the time
|
||||||
|
of creation). When new object is added to the list, it occupies part of
|
||||||
|
this block until it's full. Then the new block is allocated.
|
||||||
|
Freed objects are chained to the m_free list, and if it's not empty, the
|
||||||
|
newly added object is taken from this list instead the block.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Gcalc_dyn_list
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
class Item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Item *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
Gcalc_dyn_list(size_t blk_size, size_t sizeof_item);
|
||||||
|
~Gcalc_dyn_list();
|
||||||
|
Item *new_item()
|
||||||
|
{
|
||||||
|
Item *result;
|
||||||
|
if (m_free)
|
||||||
|
{
|
||||||
|
result= m_free;
|
||||||
|
m_free= m_free->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result= alloc_new_blk();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
inline void free_item(Item *item)
|
||||||
|
{
|
||||||
|
item->next= m_free;
|
||||||
|
m_free= item;
|
||||||
|
}
|
||||||
|
inline void free_list(Item **list, Item **hook)
|
||||||
|
{
|
||||||
|
*hook= m_free;
|
||||||
|
m_free= *list;
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_list(Item *list)
|
||||||
|
{
|
||||||
|
Item **hook= &list;
|
||||||
|
while (*hook)
|
||||||
|
hook= &(*hook)->next;
|
||||||
|
free_list(&list, hook);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
void cleanup();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
size_t m_blk_size;
|
||||||
|
size_t m_sizeof_item;
|
||||||
|
unsigned int m_points_per_blk;
|
||||||
|
void *m_first_blk;
|
||||||
|
void **m_blk_hook;
|
||||||
|
Item *m_free;
|
||||||
|
Item *m_keep;
|
||||||
|
|
||||||
|
Item *alloc_new_blk();
|
||||||
|
void format_blk(void* block);
|
||||||
|
inline Item *ptr_add(Item *ptr, int n_items)
|
||||||
|
{
|
||||||
|
return (Item *)(((char*)ptr) + n_items * m_sizeof_item);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Internal Gcalc coordinates to provide the precise calculations */
|
||||||
|
|
||||||
|
#define GCALC_DIG_BASE 1000000000
|
||||||
|
typedef uint32 gcalc_digit_t;
|
||||||
|
typedef unsigned long long gcalc_coord2;
|
||||||
|
typedef gcalc_digit_t Gcalc_internal_coord;
|
||||||
|
#define GCALC_COORD_BASE 2
|
||||||
|
#define GCALC_COORD_BASE2 4
|
||||||
|
#define GCALC_COORD_BASE3 6
|
||||||
|
#define GCALC_COORD_BASE4 8
|
||||||
|
#define GCALC_COORD_BASE5 10
|
||||||
|
|
||||||
|
typedef gcalc_digit_t Gcalc_coord1[GCALC_COORD_BASE];
|
||||||
|
typedef gcalc_digit_t Gcalc_coord2[GCALC_COORD_BASE*2];
|
||||||
|
typedef gcalc_digit_t Gcalc_coord3[GCALC_COORD_BASE*3];
|
||||||
|
|
||||||
|
|
||||||
|
void gcalc_mul_coord(Gcalc_internal_coord *result, int result_len,
|
||||||
|
const Gcalc_internal_coord *a, int a_len,
|
||||||
|
const Gcalc_internal_coord *b, int b_len);
|
||||||
|
|
||||||
|
void gcalc_add_coord(Gcalc_internal_coord *result, int result_len,
|
||||||
|
const Gcalc_internal_coord *a,
|
||||||
|
const Gcalc_internal_coord *b);
|
||||||
|
|
||||||
|
void gcalc_sub_coord(Gcalc_internal_coord *result, int result_len,
|
||||||
|
const Gcalc_internal_coord *a,
|
||||||
|
const Gcalc_internal_coord *b);
|
||||||
|
|
||||||
|
int gcalc_cmp_coord(const Gcalc_internal_coord *a,
|
||||||
|
const Gcalc_internal_coord *b, int len);
|
||||||
|
|
||||||
|
/* Internal coordinates declarations end. */
|
||||||
|
|
||||||
|
|
||||||
|
typedef uint gcalc_shape_info;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gcalc_heap represents the 'dynamic list' of Info objects, that
|
||||||
|
contain information about vertexes of all the shapes that take
|
||||||
|
part in some spatial calculation. Can become quite long.
|
||||||
|
After filled, the list is usually sorted and then walked through
|
||||||
|
in the slicescan algorithm.
|
||||||
|
The Gcalc_heap and the algorithm can only operate with two
|
||||||
|
kinds of shapes - polygon and polyline. So all the spatial
|
||||||
|
objects should be represented as sets of these two.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Gcalc_heap : public Gcalc_dyn_list
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum node_type
|
||||||
|
{
|
||||||
|
nt_shape_node,
|
||||||
|
nt_intersection,
|
||||||
|
nt_eq_node
|
||||||
|
};
|
||||||
|
class Info : public Gcalc_dyn_list::Item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
node_type type;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/* nt_shape_node */
|
||||||
|
gcalc_shape_info shape;
|
||||||
|
Info *left;
|
||||||
|
Info *right;
|
||||||
|
double x,y;
|
||||||
|
Gcalc_coord1 ix, iy;
|
||||||
|
int top_node;
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/* nt_intersection */
|
||||||
|
/* Line p1-p2 supposed to intersect line p3-p4 */
|
||||||
|
const Info *p1;
|
||||||
|
const Info *p2;
|
||||||
|
const Info *p3;
|
||||||
|
const Info *p4;
|
||||||
|
void *intersection_data;
|
||||||
|
int equal_intersection;
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/* nt_eq_node */
|
||||||
|
const Info *node;
|
||||||
|
void *eq_data;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bool is_bottom() const
|
||||||
|
{ GCALC_DBUG_ASSERT(type == nt_shape_node); return !left; }
|
||||||
|
bool is_top() const
|
||||||
|
{ GCALC_DBUG_ASSERT(type == nt_shape_node); return top_node; }
|
||||||
|
bool is_single_node() const
|
||||||
|
{ return is_bottom() && is_top(); }
|
||||||
|
|
||||||
|
void calc_xy(double *x, double *y) const;
|
||||||
|
int equal_pi(const Info *pi) const;
|
||||||
|
#ifdef GCALC_CHECK_WITH_FLOAT
|
||||||
|
void calc_xy_ld(long double *x, long double *y) const;
|
||||||
|
#endif /*GCALC_CHECK_WITH_FLOAT*/
|
||||||
|
|
||||||
|
Info *get_next() { return (Info *)next; }
|
||||||
|
const Info *get_next() const { return (const Info *)next; }
|
||||||
|
};
|
||||||
|
|
||||||
|
Gcalc_heap(size_t blk_size=8192) :
|
||||||
|
Gcalc_dyn_list(blk_size, sizeof(Info)),
|
||||||
|
m_hook(&m_first), m_n_points(0)
|
||||||
|
{}
|
||||||
|
Info *new_point_info(double x, double y, gcalc_shape_info shape);
|
||||||
|
Info *new_intersection(const Info *p1, const Info *p2,
|
||||||
|
const Info *p3, const Info *p4);
|
||||||
|
void prepare_operation();
|
||||||
|
inline bool ready() const { return m_hook == NULL; }
|
||||||
|
Info *get_first() { return (Info *)m_first; }
|
||||||
|
const Info *get_first() const { return (const Info *)m_first; }
|
||||||
|
Gcalc_dyn_list::Item **get_last_hook() { return m_hook; }
|
||||||
|
void reset();
|
||||||
|
#ifdef GCALC_CHECK_WITH_FLOAT
|
||||||
|
long double get_double(const Gcalc_internal_coord *c) const;
|
||||||
|
#endif /*GCALC_CHECK_WITH_FLOAT*/
|
||||||
|
double coord_extent;
|
||||||
|
private:
|
||||||
|
Gcalc_dyn_list::Item *m_first;
|
||||||
|
Gcalc_dyn_list::Item **m_hook;
|
||||||
|
int m_n_points;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
the spatial object has to be represented as a set of
|
||||||
|
simple polygones and polylines to be sent to the slicescan.
|
||||||
|
|
||||||
|
Gcalc_shape_transporter class and his descendants are used to
|
||||||
|
simplify storing the information about the shape into necessary structures.
|
||||||
|
This base class only fills the Gcalc_heap with the information about
|
||||||
|
shapes and vertices.
|
||||||
|
|
||||||
|
Normally the Gcalc_shape_transporter family object is sent as a parameter
|
||||||
|
to the 'get_shapes' method of an 'spatial' object so it can pass
|
||||||
|
the spatial information about itself. The virtual methods are
|
||||||
|
treating this data in a way the caller needs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Gcalc_shape_transporter
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Gcalc_heap::Info *m_first;
|
||||||
|
Gcalc_heap::Info *m_prev;
|
||||||
|
int m_shape_started;
|
||||||
|
void int_complete();
|
||||||
|
protected:
|
||||||
|
Gcalc_heap *m_heap;
|
||||||
|
int int_single_point(gcalc_shape_info Info, double x, double y);
|
||||||
|
int int_add_point(gcalc_shape_info Info, double x, double y);
|
||||||
|
void int_start_line()
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(!m_shape_started);
|
||||||
|
m_shape_started= 1;
|
||||||
|
m_first= m_prev= NULL;
|
||||||
|
}
|
||||||
|
void int_complete_line()
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(m_shape_started== 1);
|
||||||
|
int_complete();
|
||||||
|
m_shape_started= 0;
|
||||||
|
}
|
||||||
|
void int_start_ring()
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(m_shape_started== 2);
|
||||||
|
m_shape_started= 3;
|
||||||
|
m_first= m_prev= NULL;
|
||||||
|
}
|
||||||
|
void int_complete_ring()
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(m_shape_started== 3);
|
||||||
|
int_complete();
|
||||||
|
m_shape_started= 2;
|
||||||
|
}
|
||||||
|
void int_start_poly()
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(!m_shape_started);
|
||||||
|
m_shape_started= 2;
|
||||||
|
}
|
||||||
|
void int_complete_poly()
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(m_shape_started== 2);
|
||||||
|
m_shape_started= 0;
|
||||||
|
}
|
||||||
|
bool line_started() { return m_shape_started == 1; };
|
||||||
|
public:
|
||||||
|
Gcalc_shape_transporter(Gcalc_heap *heap) :
|
||||||
|
m_shape_started(0), m_heap(heap) {}
|
||||||
|
|
||||||
|
virtual int single_point(double x, double y)=0;
|
||||||
|
virtual int start_line()=0;
|
||||||
|
virtual int complete_line()=0;
|
||||||
|
virtual int start_poly()=0;
|
||||||
|
virtual int complete_poly()=0;
|
||||||
|
virtual int start_ring()=0;
|
||||||
|
virtual int complete_ring()=0;
|
||||||
|
virtual int add_point(double x, double y)=0;
|
||||||
|
virtual int start_collection(int n_objects) { return 0; }
|
||||||
|
virtual int empty_shape() { return 0; }
|
||||||
|
int start_simple_poly()
|
||||||
|
{
|
||||||
|
return start_poly() || start_ring();
|
||||||
|
}
|
||||||
|
int complete_simple_poly()
|
||||||
|
{
|
||||||
|
return complete_ring() || complete_poly();
|
||||||
|
}
|
||||||
|
virtual ~Gcalc_shape_transporter() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum Gcalc_scan_events
|
||||||
|
{
|
||||||
|
scev_none= 0,
|
||||||
|
scev_point= 1, /* Just a new point in thread */
|
||||||
|
scev_thread= 2, /* Start of the new thread */
|
||||||
|
scev_two_threads= 4, /* A couple of new threads started */
|
||||||
|
scev_intersection= 8, /* Intersection happened */
|
||||||
|
scev_end= 16, /* Single thread finished */
|
||||||
|
scev_two_ends= 32, /* A couple of threads finished */
|
||||||
|
scev_single_point= 64 /* Got single point */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gcalc_scan_iterator incapsulates the slisescan algorithm.
|
||||||
|
It takes filled Gcalc_heap as an datasource. Then can be
|
||||||
|
iterated trought the vertexes and intersection points with
|
||||||
|
the step() method. After the 'step()' one usually observes
|
||||||
|
the current 'slice' to do the necessary calculations, like
|
||||||
|
looking for intersections, calculating the area, whatever.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Gcalc_scan_iterator : public Gcalc_dyn_list
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
class point : public Gcalc_dyn_list::Item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Gcalc_coord1 dx;
|
||||||
|
Gcalc_coord1 dy;
|
||||||
|
Gcalc_heap::Info *pi;
|
||||||
|
Gcalc_heap::Info *next_pi;
|
||||||
|
Gcalc_heap::Info *ev_pi;
|
||||||
|
const Gcalc_coord1 *l_border;
|
||||||
|
const Gcalc_coord1 *r_border;
|
||||||
|
point *ev_next;
|
||||||
|
|
||||||
|
Gcalc_scan_events event;
|
||||||
|
|
||||||
|
inline const point *c_get_next() const
|
||||||
|
{ return (const point *)next; }
|
||||||
|
inline bool is_bottom() const { return !next_pi; }
|
||||||
|
gcalc_shape_info get_shape() const { return pi->shape; }
|
||||||
|
inline point *get_next() { return (point *)next; }
|
||||||
|
inline const point *get_next() const { return (const point *)next; }
|
||||||
|
/* Compare the dx_dy parameters regarding the horiz_dir */
|
||||||
|
/* returns -1 if less, 0 if equal, 1 if bigger */
|
||||||
|
static int cmp_dx_dy(const Gcalc_coord1 dx_a,
|
||||||
|
const Gcalc_coord1 dy_a,
|
||||||
|
const Gcalc_coord1 dx_b,
|
||||||
|
const Gcalc_coord1 dy_b);
|
||||||
|
static int cmp_dx_dy(const Gcalc_heap::Info *p1,
|
||||||
|
const Gcalc_heap::Info *p2,
|
||||||
|
const Gcalc_heap::Info *p3,
|
||||||
|
const Gcalc_heap::Info *p4);
|
||||||
|
int cmp_dx_dy(const point *p) const;
|
||||||
|
point **next_ptr() { return (point **) &next; }
|
||||||
|
#ifndef GCALC_DBUG_OFF
|
||||||
|
unsigned int thread;
|
||||||
|
#endif /*GCALC_DBUG_OFF*/
|
||||||
|
#ifdef GCALC_CHECK_WITH_FLOAT
|
||||||
|
void calc_x(long double *x, long double y, long double ix) const;
|
||||||
|
#endif /*GCALC_CHECK_WITH_FLOAT*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/* That class introduced mostly for the 'typecontrol' reason. */
|
||||||
|
/* only difference from the point classis the get_next() function. */
|
||||||
|
class event_point : public point
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline const event_point *get_next() const
|
||||||
|
{ return (const event_point*) ev_next; }
|
||||||
|
int simple_event() const
|
||||||
|
{
|
||||||
|
return !ev_next ? (event & (scev_point | scev_end)) :
|
||||||
|
(!ev_next->ev_next && event == scev_two_ends);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class intersection_info : public Gcalc_dyn_list::Item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
point *edge_a;
|
||||||
|
point *edge_b;
|
||||||
|
|
||||||
|
Gcalc_coord2 t_a;
|
||||||
|
Gcalc_coord2 t_b;
|
||||||
|
int t_calculated;
|
||||||
|
Gcalc_coord3 x_exp;
|
||||||
|
int x_calculated;
|
||||||
|
Gcalc_coord3 y_exp;
|
||||||
|
int y_calculated;
|
||||||
|
void calc_t()
|
||||||
|
{if (!t_calculated) do_calc_t(); }
|
||||||
|
void calc_y_exp()
|
||||||
|
{ if (!y_calculated) do_calc_y(); }
|
||||||
|
void calc_x_exp()
|
||||||
|
{ if (!x_calculated) do_calc_x(); }
|
||||||
|
|
||||||
|
void do_calc_t();
|
||||||
|
void do_calc_x();
|
||||||
|
void do_calc_y();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class slice_state
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
point *slice;
|
||||||
|
point **event_position_hook;
|
||||||
|
point *event_end;
|
||||||
|
const Gcalc_heap::Info *pi;
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
Gcalc_scan_iterator(size_t blk_size= 8192);
|
||||||
|
|
||||||
|
GCALC_DECL_TERMINATED_STATE(killed)
|
||||||
|
|
||||||
|
void init(Gcalc_heap *points); /* Iterator can be reused */
|
||||||
|
void reset();
|
||||||
|
int step();
|
||||||
|
|
||||||
|
Gcalc_heap::Info *more_points() { return m_cur_pi; }
|
||||||
|
bool more_trapezoids()
|
||||||
|
{ return m_cur_pi && m_cur_pi->next; }
|
||||||
|
|
||||||
|
const point *get_bottom_points() const
|
||||||
|
{ return m_bottom_points; }
|
||||||
|
const point *get_event_position() const
|
||||||
|
{ return *state.event_position_hook; }
|
||||||
|
const point *get_event_end() const
|
||||||
|
{ return state.event_end; }
|
||||||
|
const event_point *get_events() const
|
||||||
|
{ return (const event_point *)
|
||||||
|
(*state.event_position_hook == state.event_end ?
|
||||||
|
m_bottom_points : *state.event_position_hook); }
|
||||||
|
const point *get_b_slice() const { return state.slice; }
|
||||||
|
double get_h() const;
|
||||||
|
double get_y() const;
|
||||||
|
double get_event_x() const;
|
||||||
|
double get_sp_x(const point *sp) const;
|
||||||
|
int intersection_step() const
|
||||||
|
{ return state.pi->type == Gcalc_heap::nt_intersection; }
|
||||||
|
const Gcalc_heap::Info *get_cur_pi() const
|
||||||
|
{
|
||||||
|
return state.pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Gcalc_heap *m_heap;
|
||||||
|
Gcalc_heap::Info *m_cur_pi;
|
||||||
|
slice_state state;
|
||||||
|
|
||||||
|
#ifndef GCALC_DBUG_OFF
|
||||||
|
unsigned int m_cur_thread;
|
||||||
|
#endif /*GCALC_DBUG_OFF*/
|
||||||
|
|
||||||
|
point *m_bottom_points;
|
||||||
|
point **m_bottom_hook;
|
||||||
|
|
||||||
|
int node_scan();
|
||||||
|
void eq_scan();
|
||||||
|
void intersection_scan();
|
||||||
|
void remove_bottom_node();
|
||||||
|
int insert_top_node();
|
||||||
|
int add_intersection(point *sp_a, point *sp_b,
|
||||||
|
Gcalc_heap::Info *pi_from);
|
||||||
|
int add_eq_node(Gcalc_heap::Info *node, point *sp);
|
||||||
|
int add_events_for_node(point *sp_node);
|
||||||
|
|
||||||
|
point *new_slice_point()
|
||||||
|
{
|
||||||
|
point *new_point= (point *)new_item();
|
||||||
|
return new_point;
|
||||||
|
}
|
||||||
|
intersection_info *new_intersection_info(point *a, point *b)
|
||||||
|
{
|
||||||
|
intersection_info *ii= (intersection_info *)new_item();
|
||||||
|
ii->edge_a= a;
|
||||||
|
ii->edge_b= b;
|
||||||
|
ii->t_calculated= ii->x_calculated= ii->y_calculated= 0;
|
||||||
|
return ii;
|
||||||
|
}
|
||||||
|
int arrange_event(int do_sorting, int n_intersections);
|
||||||
|
static double get_pure_double(const Gcalc_internal_coord *d, int d_len);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gcalc_trapezoid_iterator simplifies the calculations on
|
||||||
|
the current slice of the Gcalc_scan_iterator.
|
||||||
|
One can walk through the trapezoids formed between
|
||||||
|
previous and current slices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef TMP_BLOCK
|
||||||
|
class Gcalc_trapezoid_iterator
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
const Gcalc_scan_iterator::point *sp0;
|
||||||
|
const Gcalc_scan_iterator::point *sp1;
|
||||||
|
public:
|
||||||
|
Gcalc_trapezoid_iterator(const Gcalc_scan_iterator *scan_i) :
|
||||||
|
sp0(scan_i->get_b_slice()),
|
||||||
|
sp1(scan_i->get_t_slice())
|
||||||
|
{}
|
||||||
|
|
||||||
|
inline bool more() const { return sp1 && sp1->next; }
|
||||||
|
|
||||||
|
const Gcalc_scan_iterator::point *lt() const { return sp1; }
|
||||||
|
const Gcalc_scan_iterator::point *lb() const { return sp0; }
|
||||||
|
const Gcalc_scan_iterator::point *rb() const
|
||||||
|
{
|
||||||
|
const Gcalc_scan_iterator::point *result= sp0;
|
||||||
|
while ((result= result->c_get_next())->is_bottom())
|
||||||
|
{}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
const Gcalc_scan_iterator::point *rt() const
|
||||||
|
{ return sp1->c_get_next(); }
|
||||||
|
|
||||||
|
void operator++()
|
||||||
|
{
|
||||||
|
sp0= rb();
|
||||||
|
sp1= rt();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif /*TMP_BLOCK*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gcalc_point_iterator simplifies the calculations on
|
||||||
|
the current slice of the Gcalc_scan_iterator.
|
||||||
|
One can walk through the points on the current slice.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Gcalc_point_iterator
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
const Gcalc_scan_iterator::point *sp;
|
||||||
|
public:
|
||||||
|
Gcalc_point_iterator(const Gcalc_scan_iterator *scan_i):
|
||||||
|
sp(scan_i->get_b_slice())
|
||||||
|
{}
|
||||||
|
|
||||||
|
inline bool more() const { return sp != NULL; }
|
||||||
|
inline void operator++() { sp= sp->c_get_next(); }
|
||||||
|
inline const Gcalc_scan_iterator::point *point() const { return sp; }
|
||||||
|
inline const Gcalc_heap::Info *get_pi() const { return sp->pi; }
|
||||||
|
inline gcalc_shape_info get_shape() const { return sp->get_shape(); }
|
||||||
|
inline void restart(const Gcalc_scan_iterator *scan_i)
|
||||||
|
{ sp= scan_i->get_b_slice(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GCALC_SLICESCAN_INCLUDED*/
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user