mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Fix cost calculation in test_if_cheaper_ordering() to be cost based
The original code was mostly rule based and preferred clustered or covering indexed independent of cost. There where a few test changes: - Some test changed from using filesort to index or table scan. This happened when most of the rows had to be sorted and the ORDER BY could use covering or a clustered index (innodb_mysql, create_spatial_index). - Some test changed range to filesort. This where mainly because the range was scanning most of the rows or using index scan + row lookup and filesort with table scan is cheaper. (order_by). - Change in join_cache was because sorting 2 rows is faster than retrieving 10 rows. - In selectivity_innodb.test one test changed to use a cheaper index.
This commit is contained in:
@ -57,6 +57,7 @@ ANALYZE TABLE tab;
|
||||
Table Op Msg_type Msg_text
|
||||
test.tab analyze status Engine-independent statistics collected
|
||||
test.tab analyze status OK
|
||||
# Test the MBRContains
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -85,6 +86,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRWithin
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) ');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -99,6 +101,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the ST_Crosses
|
||||
SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -127,6 +130,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRDisjoint
|
||||
SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -149,6 +153,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the MBREquals
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -166,7 +171,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -194,6 +199,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the Overelaps
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -222,10 +228,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the ST_Touches
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
@ -250,6 +257,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRContains
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -278,6 +286,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRDisjoint
|
||||
SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -300,6 +309,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the MBREquals
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -314,10 +324,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRintersects
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -345,6 +356,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBROverelaps
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -359,10 +371,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRTouches
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
@ -373,6 +386,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where
|
||||
# Test with Procedure
|
||||
CREATE PROCEDURE proc_wl6968()
|
||||
BEGIN
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
@ -388,6 +402,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the Delete & Update
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
@ -486,6 +501,7 @@ ANALYZE TABLE tab;
|
||||
Table Op Msg_type Msg_text
|
||||
test.tab analyze status Engine-independent statistics collected
|
||||
test.tab analyze status OK
|
||||
# Test the MBRContains
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -514,6 +530,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRWithin
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) ');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -528,6 +545,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the ST_Crosses
|
||||
SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -556,6 +574,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRDisjoint
|
||||
SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -578,6 +597,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the MBREquals
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -592,6 +612,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRintersects
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -623,6 +644,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the Overelaps
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -651,6 +673,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the ST_Touches
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -679,6 +702,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRContains
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -707,6 +731,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRDisjoint
|
||||
SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -729,6 +754,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the MBREquals
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -743,6 +769,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRintersects
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -774,6 +801,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBROverelaps
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -788,6 +816,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRTouches
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -802,6 +831,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where
|
||||
# Test with Procedure
|
||||
CREATE PROCEDURE proc_wl6968()
|
||||
BEGIN
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
@ -817,6 +847,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the Delete & Update
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) ');
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
@ -904,6 +935,7 @@ ANALYZE TABLE tab;
|
||||
Table Op Msg_type Msg_text
|
||||
test.tab analyze status Engine-independent statistics collected
|
||||
test.tab analyze status OK
|
||||
# Test the MBRContains
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -932,6 +964,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRWithin
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) ');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -946,6 +979,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the ST_Crosses
|
||||
SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -974,6 +1008,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRDisjoint
|
||||
SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -996,6 +1031,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the MBREquals
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -1010,10 +1046,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRintersects
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -1041,6 +1078,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the Overelaps
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -1069,10 +1107,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the ST_Touches
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
@ -1097,6 +1136,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRContains
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -1125,6 +1165,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRDisjoint
|
||||
SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -1147,6 +1188,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where
|
||||
# Test the MBREquals
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -1161,10 +1203,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRintersects
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -1192,6 +1235,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBROverelaps
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -1206,10 +1250,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where
|
||||
# Test the MBRTouches
|
||||
SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
@ -1220,6 +1265,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where
|
||||
# Test the Delete & Update
|
||||
SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))');
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
@ -1243,6 +1289,7 @@ CHECK TABLE tab;
|
||||
Table Op Msg_type Msg_text
|
||||
test.tab check status OK
|
||||
DROP TABLE tab;
|
||||
# Test check constraint on spatial column
|
||||
CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB;
|
||||
ERROR HY000: Illegal parameter data types point and int for operation '>'
|
||||
CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(CAST(c1 AS BINARY) > 0) ) ENGINE=InnoDB;
|
||||
|
Reference in New Issue
Block a user