[CP] [MySQL GIS] fix spatial index coveredby keypart generation

This commit is contained in:
obdev
2024-02-08 03:57:16 +00:00
committed by ob-robot
parent c4188df8ab
commit 8921cc28a8
5 changed files with 296 additions and 197 deletions

View File

@ -1192,7 +1192,7 @@ INSERT INTO t (g) VALUES
(ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))')),
(ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))')),
(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
st_astext(g)
POINT(0 0)
LINESTRING(0 0,1 1)
@ -1201,10 +1201,10 @@ MULTIPOINT((0 0),(1 1))
MULTILINESTRING((0 0,1 1),(4 4,5 5))
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(2 2,3 3))
select st_astext(g) from t where _st_covers(ST_GeomFromText('POINT(0 0)'), g);
select st_astext(g) from t ignore index(idx) where _st_covers(ST_GeomFromText('POINT(0 0)'), g);
st_astext(g)
POINT(0 0)
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(1 1)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(1 1)'));
st_astext(g)
POINT(1 1)
LINESTRING(0 0,1 1)
@ -1212,52 +1212,52 @@ POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTIPOINT((0 0),(1 1))
MULTILINESTRING((0 0,1 1),(4 4,5 5))
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(2 2)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(2 2)'));
st_astext(g)
POINT(2 2)
POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(2 2,3 3))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(3 3)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(3 3)'));
st_astext(g)
POINT(3 3)
POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(2 2,3 3))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(4 4)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(4 4)'));
st_astext(g)
POINT(4 4)
POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTILINESTRING((0 0,1 1),(4 4,5 5))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(5 5)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(5 5)'));
st_astext(g)
POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTILINESTRING((0 0,1 1),(4 4,5 5))
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
st_astext(g)
LINESTRING(0 0,1 1)
POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTILINESTRING((0 0,1 1),(4 4,5 5))
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
st_astext(g)
POLYGON((0 0,10 0,10 5,0 5,0 0))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
st_astext(g)
LINESTRING(0 0,1 1)
POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTIPOINT((0 0),(1 1))
MULTILINESTRING((0 0,1 1),(4 4,5 5))
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
st_astext(g)
POLYGON((0 0,10 0,10 5,0 5,0 0))
MULTILINESTRING((0 0,1 1),(4 4,5 5))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
st_astext(g)
MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)),((2.5 2.5,6 2.5,6 6,2.5 6,2.5 2.5),(3.5 3,4.5 3,4.5 4.5,3.5 4.5,3.5 3)))
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
st_astext(g)
POLYGON((0 0,10 0,10 5,0 5,0 0))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(2 2,3 3))
@ -1518,27 +1518,28 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |527 |
|0 |TABLE FULL SCAN|t(idx)|1 |540 |
=================================================
Outputs & filters:
-------------------------------------
0 - output([st_astext(t.g)]), filter([BOOL(_st_covers(t.g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')))])
access([t.__pk_increment], [t.g]), partitions(p0)
is_index_back=true, is_global_index=false, filter_before_indexback[false],
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,
MIN,MIN ; 1152921504606847040,MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,
MAX,MAX), (1152921504606851072,MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,
MIN,MIN ; 1152921504606912512,MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,
MAX,MAX), (1152921504611041280,MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,
MIN,MIN ; 1152921504673955840,MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,
MAX,MAX), (1152921508901814272,MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,
MIN,MIN ; 1152921573326323712,MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,
MAX,MAX), (1152925902653358080,MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,
MIN,MIN ; 1152991873351024640,MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,
MAX,MAX), (1157425104234217472,MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,
MIN,MIN ; 1224979098644774912,MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,
MAX,MAX), (1152921504606846980,MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846985,MIN,MIN ; 1152921504606846985,MAX,MAX), (1152921504606846991,
MIN,MIN ; 1152921504606846991,MAX,MAX)
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846980,
MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX), (1152921504606846979,
MIN,MIN ; 1152921504606846979,MAX,MAX), (1152921504606846985,MIN,MIN ; 1152921504606846985,MAX,MAX), (1152921504606846988,MIN,MIN ; 1152921504606846988,
MAX,MAX), (1152921504606846991,MIN,MIN ; 1152921504606846991,MAX,MAX)
Used Hint:
-------------------------------------
/*+
@ -1648,19 +1649,19 @@ Outputs & filters:
0 - output([st_astext(t.g)]), filter([BOOL(_st_covers(t.g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))')))])
access([t.__pk_increment], [t.g]), partitions(p0)
is_index_back=true, is_global_index=false, filter_before_indexback[false],
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846980,MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846992,
MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,
MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,
MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,
MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,
MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,
MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,
MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,
MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,
MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,
MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,
MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,
MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX), (1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846981,
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846980,
MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX), (1152921504606846981,
MIN,MIN ; 1152921504606846981,MAX,MAX)
Used Hint:
-------------------------------------
@ -2612,27 +2613,28 @@ Query Plan
=================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------
|0 |TABLE FULL SCAN|t(idx)|1 |527 |
|0 |TABLE FULL SCAN|t(idx)|1 |540 |
=================================================
Outputs & filters:
-------------------------------------
0 - output([st_astext(t.g)]), filter([BOOL(ST_Contains(t.g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')))])
access([t.__pk_increment], [t.g]), partitions(p0)
is_index_back=true, is_global_index=false, filter_before_indexback[false],
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,
MIN,MIN ; 1152921504606847040,MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,
MAX,MAX), (1152921504606851072,MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,
MIN,MIN ; 1152921504606912512,MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,
MAX,MAX), (1152921504611041280,MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,
MIN,MIN ; 1152921504673955840,MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,
MAX,MAX), (1152921508901814272,MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,
MIN,MIN ; 1152921573326323712,MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,
MAX,MAX), (1152925902653358080,MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,
MIN,MIN ; 1152991873351024640,MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,
MAX,MAX), (1157425104234217472,MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,
MIN,MIN ; 1224979098644774912,MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,
MAX,MAX), (1152921504606846980,MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846985,MIN,MIN ; 1152921504606846985,MAX,MAX), (1152921504606846991,
MIN,MIN ; 1152921504606846991,MAX,MAX)
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846980,
MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX), (1152921504606846979,
MIN,MIN ; 1152921504606846979,MAX,MAX), (1152921504606846985,MIN,MIN ; 1152921504606846985,MAX,MAX), (1152921504606846988,MIN,MIN ; 1152921504606846988,
MAX,MAX), (1152921504606846991,MIN,MIN ; 1152921504606846991,MAX,MAX)
Used Hint:
-------------------------------------
/*+
@ -2742,19 +2744,19 @@ Outputs & filters:
0 - output([st_astext(t.g)]), filter([BOOL(ST_Contains(t.g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))')))])
access([t.__pk_increment], [t.g]), partitions(p0)
is_index_back=true, is_global_index=false, filter_before_indexback[false],
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846980,MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846992,
MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,
MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,
MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,
MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,
MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,
MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,
MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,
MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,
MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,
MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,
MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,
MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX), (1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846981,
range_key([t.__cellid_16], [t.__mbr_16], [t.__pk_increment]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846980,
MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX), (1152921504606846981,
MIN,MIN ; 1152921504606846981,MAX,MAX)
Used Hint:
-------------------------------------
@ -3138,3 +3140,51 @@ id st_astext(g)
4 POINT(5.00001 5)
7 MULTIPOINT((5.00001 5))
drop table geo_t1;
bugfix: 53822176
drop table if exists spatial_point_in_line;
create table spatial_point_in_line (
`id` int unsigned not null auto_increment primary key ,
`min` int unsigned not null default 0,
`max` int unsigned not null default 0,
`line_geo` geometry not null srid 0,
SPATIAL INDEX index_spatial_line_geo(`line_geo`)
);
insert into spatial_point_in_line (min, max, line_geo) values
(80, 90, LineString(Point(min, 0), Point(max, 0))),
(80, 100, LineString(Point(min, 0), Point(max, 0))),
(90, 100, LineString(Point(min, 0), Point(max, 0))),
(100, 110, LineString(Point(min, 0), Point(max, 0))),
(100, 120, LineString(Point(min, 0), Point(max, 0)));
select id, min, max, st_astext(line_geo) from spatial_point_in_line where ST_Contains(line_geo, LineString(Point(80, 0), Point(91, 0)));
id min max st_astext(line_geo)
2 80 100 LINESTRING(80 0,100 0)
explain select id, min, max, st_astext(line_geo) from spatial_point_in_line where ST_Contains(line_geo, LineString(Point(80, 0), Point(91, 0)));
Query Plan
========================================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------------------------------
|0 |TABLE FULL SCAN|spatial_point_in_line(index_spatial_line_geo)|1 |279 |
========================================================================================
Outputs & filters:
-------------------------------------
0 - output([spatial_point_in_line.id], [spatial_point_in_line.min], [spatial_point_in_line.max], [st_astext(spatial_point_in_line.line_geo)]), filter([ST_Contains(spatial_point_in_line.line_geo,
linestring(point(cast(80, DOUBLE(-1, -1)), cast(0, DOUBLE(-1, -1))), point(cast(91, DOUBLE(-1, -1)), cast(0, DOUBLE(-1, -1)))))])
access([spatial_point_in_line.id], [spatial_point_in_line.line_geo], [spatial_point_in_line.min], [spatial_point_in_line.max]), partitions(p0)
is_index_back=true, is_global_index=false, filter_before_indexback[false],
range_key([spatial_point_in_line.__cellid_19], [spatial_point_in_line.__mbr_19], [spatial_point_in_line.id]), range(1152921504606848865,MIN,MIN ;
1152921504606848865,MAX,MAX), (1152921504606848868,MIN,MIN ; 1152921504606848868,MAX,MAX), (1152921504606848880,MIN,MIN ; 1152921504606848880,MAX,MAX),
(1152921504606848832,MIN,MIN ; 1152921504606848832,MAX,MAX), (1152921504606848768,MIN,MIN ; 1152921504606848768,MAX,MAX), (1152921504606848000,MIN,MIN ;
1152921504606848000,MAX,MAX), (1152921504606851072,MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX),
(1152921504606912512,MIN,MIN ; 1152921504606912512,MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ;
1152921504607895552,MAX,MAX), (1152921504611041280,MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX),
(1152921504673955840,MIN,MIN ; 1152921504673955840,MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ;
1152921505680588800,MAX,MAX), (1152921508901814272,MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX),
(1152921573326323712,MIN,MIN ; 1152921573326323712,MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ;
1152922604118474752,MAX,MAX), (1152925902653358080,MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX),
(1152991873351024640,MIN,MIN ; 1152991873351024640,MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ;
1154047404513689600,MAX,MAX), (1157425104234217472,MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX),
(1224979098644774912,MIN,MIN ; 1224979098644774912,MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ;
1152921504606846976,MAX,MAX), (1152921504606848893,MIN,MIN ; 1152921504606848893,MAX,MAX), (1152921504606848892,MIN,MIN ; 1152921504606848892,MAX,MAX)
select id, min, max, st_astext(line_geo) from spatial_point_in_line ignore index(geom_idx_1) where ST_Contains(line_geo, LineString(Point(80, 0), Point(91, 0)));
id min max st_astext(line_geo)
2 80 100 LINESTRING(80 0,100 0)

View File

@ -1,47 +1,47 @@
# ----------------------------------------------------------------------
# Base test of GEOMETRY spatial index.
# ----------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
create spatial index idx on t1 (g) local;
insert into t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
explain select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
DROP TABLE IF EXISTS partition_t1;
create table partition_t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
create spatial index idx on partition_t1 (g) local;
insert into partition_t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
explain select /*+index(partition_t1 idx)*/ st_astext(g) from partition_t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
Query Plan
=============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------
|0 |PX COORDINATOR | |1 |291 |
|1 |└─EXCHANGE OUT DISTR |:EX10000|1 |291 |
|2 | └─PX PARTITION ITERATOR| |1 |289 |
|3 | └─TABLE FULL SCAN |t1(idx) |1 |289 |
=============================================================
======================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |291 |
|1 |└─EXCHANGE OUT DISTR |:EX10000 |1 |291 |
|2 | └─PX PARTITION ITERATOR| |1 |289 |
|3 | └─TABLE FULL SCAN |partition_t1(idx)|1 |289 |
======================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(st_astext(t1.g))]), filter(nil)
1 - output([INTERNAL_FUNCTION(st_astext(t1.g))]), filter(nil)
0 - output([INTERNAL_FUNCTION(st_astext(partition_t1.g))]), filter(nil)
1 - output([INTERNAL_FUNCTION(st_astext(partition_t1.g))]), filter(nil)
dop=1
2 - output([t1.g]), filter(nil)
2 - output([partition_t1.g]), filter(nil)
force partition granule
3 - output([t1.g]), filter([st_intersects(t1.g, st_geomfromtext('point(1 1)'))])
access([t1.c1], [t1.g]), partitions(p[0-1])
3 - output([partition_t1.g]), filter([st_intersects(partition_t1.g, st_geomfromtext('point(1 1)'))])
access([partition_t1.c1], [partition_t1.g]), partitions(p[0-1])
is_index_back=true, is_global_index=false, filter_before_indexback[false],
range_key([t1.__cellid_17], [t1.__mbr_17], [t1.c1]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846980,MIN,MIN
; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,MAX,MAX),
(1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,MIN,MIN
; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,MAX,MAX),
(1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,MIN,MIN
; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,MAX,MAX),
(1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,MIN,MIN
; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,MAX,MAX),
(1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,MIN,MIN
; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,MAX,MAX),
(1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,MIN,MIN
; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,MAX,MAX),
(1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
range_key([partition_t1.__cellid_17], [partition_t1.__mbr_17], [partition_t1.c1]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX),
(1152921504606846980,MIN,MIN ; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN
; 1152921504606847040,MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX),
(1152921504606851072,MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN
; 1152921504606912512,MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX),
(1152921504611041280,MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN
; 1152921504673955840,MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX),
(1152921508901814272,MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN
; 1152921573326323712,MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX),
(1152925902653358080,MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN
; 1152991873351024640,MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX),
(1157425104234217472,MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN
; 1224979098644774912,MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
select /*+index(partition_t1 idx)*/ st_astext(g) from partition_t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
st_astext(g)
POINT(1 1)
drop table t1;
drop table partition_t1;
DROP TABLE IF EXISTS t1;
create table t1(c1 int primary key, g geometry not null srid 0) partition by range(c1) ( partition p0 values less than (4),
partition p1 values less than (10));

View File

@ -312,19 +312,19 @@ INSERT INTO t (g) VALUES
(ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))')),
(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
select st_astext(g) from t where _st_covers(ST_GeomFromText('POINT(0 0)'), g);
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(1 1)'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(2 2)'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(3 3)'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(4 4)'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(5 5)'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
select st_astext(g) from t ignore index(idx) where _st_covers(ST_GeomFromText('POINT(0 0)'), g);
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(1 1)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(2 2)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(3 3)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(4 4)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POINT(5 5)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
select st_astext(g) from t ignore index(idx) where _st_covers(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
@ -487,4 +487,26 @@ select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where st_within(g, ST_Geo
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where _st_covers(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'), g);
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where _st_covers(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'), g);
drop table geo_t1;
drop table geo_t1;
--echo bugfix: 53822176
--disable_warnings
drop table if exists spatial_point_in_line;
--enable_warnings
create table spatial_point_in_line (
`id` int unsigned not null auto_increment primary key ,
`min` int unsigned not null default 0,
`max` int unsigned not null default 0,
`line_geo` geometry not null srid 0,
SPATIAL INDEX index_spatial_line_geo(`line_geo`)
);
insert into spatial_point_in_line (min, max, line_geo) values
(80, 90, LineString(Point(min, 0), Point(max, 0))),
(80, 100, LineString(Point(min, 0), Point(max, 0))),
(90, 100, LineString(Point(min, 0), Point(max, 0))),
(100, 110, LineString(Point(min, 0), Point(max, 0))),
(100, 120, LineString(Point(min, 0), Point(max, 0)));
select id, min, max, st_astext(line_geo) from spatial_point_in_line where ST_Contains(line_geo, LineString(Point(80, 0), Point(91, 0)));
explain select id, min, max, st_astext(line_geo) from spatial_point_in_line where ST_Contains(line_geo, LineString(Point(80, 0), Point(91, 0)));
select id, min, max, st_astext(line_geo) from spatial_point_in_line ignore index(geom_idx_1) where ST_Contains(line_geo, LineString(Point(80, 0), Point(91, 0)));

View File

@ -6,14 +6,14 @@
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS partition_t1;
--enable_warnings
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
create spatial index idx on t1 (g) local;
insert into t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
explain select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
drop table t1;
create table partition_t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
create spatial index idx on partition_t1 (g) local;
insert into partition_t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
explain select /*+index(partition_t1 idx)*/ st_astext(g) from partition_t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
select /*+index(partition_t1 idx)*/ st_astext(g) from partition_t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
drop table partition_t1;
--disable_warnings
DROP TABLE IF EXISTS t1;