mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Added test cases for preceding test
This includes all test changes from "Changing all cost calculation to be given in milliseconds" and forwards. Some of the things that caused changes in the result files: - As part of fixing tests, I added 'echo' to some comments to be able to easier find out where things where wrong. - MATERIALIZED has now a higher cost compared to X than before. Because of this some MATERIALIZED types have changed to DEPENDEND SUBQUERY. - Some test cases that required MATERIALIZED to repeat a bug was changed by adding more rows to force MATERIALIZED to happen. - 'Filtered' in SHOW EXPLAIN has in many case changed from 100.00 to something smaller. This is because now filtered also takes into account the smallest possible ref access and filters, even if they where not used. Another reason for 'Filtered' being smaller is that we now also take into account implicit filtering done for subqueries using FIRSTMATCH. (main.subselect_no_exists_to_in) This is caluculated in best_access_path() and stored in records_out. - Table orders has changed because more accurate costs. - 'index' and 'ALL' for small tables has changed to use 'range' or 'ref' because of optimizer_scan_setup_cost. - index can be changed to 'range' as 'range' optimizer assumes we don't have to read the blocks from disk that range optimizer has already read. This can be confusing in the case where there is no obvious where clause but instead there is a hidden 'key_column > NULL' added by the optimizer. (main.subselect_no_exists_to_in) - Scan on primary clustered key does not report 'Using Index' anymore (It's a table scan, not an index scan). - For derived tables, the number of rows is now 100 instead of 2, which can be seen in EXPLAIN. - More tests have "Using index for group by" as the cost of this optimization is now more correct (lower). - A primary key could be preferred for a normal key, even if it would access more rows, as it's faster to do 1 lokoup and 3 'index_next' on a clustered primary key than one lookup trough a secondary. (main.stat_tables_innodb) Notes: - There was a 4.7% more calls to best_extension_by_limited_search() in the main.greedy_optimizer test. However examining the test results it looked that the plans where slightly better (eq_ref where more chained together) so I assume this is ok. - I have verified a few test cases where there was notable/unexpected changes in the plan and in all cases the new optimizer plans where faster. (main.greedy_optimizer and some others)
This commit is contained in:
@ -59,9 +59,12 @@ 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;
|
||||
EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1+0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
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
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
@ -75,7 +78,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)');
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
@ -90,7 +93,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -105,7 +108,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
@ -119,7 +122,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)');
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -149,15 +152,15 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
@ -187,7 +190,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)');
|
||||
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 1 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))
|
||||
@ -203,7 +206,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
@ -224,10 +227,10 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 8 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 8 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;
|
||||
@ -246,7 +249,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)');
|
||||
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 1 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)
|
||||
4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
@ -261,7 +264,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
@ -275,7 +278,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -305,15 +308,15 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
@ -344,7 +347,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)');
|
||||
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 1 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))
|
||||
@ -360,7 +363,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
@ -397,7 +400,7 @@ EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1);
|
||||
END |
|
||||
CALL proc_wl6968();
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 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
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -578,7 +581,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where; Using filesort
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where; Using filesort
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -593,10 +596,10 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 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;
|
||||
@ -662,17 +665,17 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )');
|
||||
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
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where; Using filesort
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 8 Using where; Using filesort
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 8 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 8 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;
|
||||
@ -735,7 +738,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where; Using filesort
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where; Using filesort
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -750,10 +753,10 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 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;
|
||||
@ -939,7 +942,7 @@ test.tab analyze status OK
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
@ -953,7 +956,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)');
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
@ -968,7 +971,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -983,7 +986,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
@ -997,7 +1000,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)');
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -1027,15 +1030,15 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
@ -1066,7 +1069,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)');
|
||||
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 1 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))
|
||||
@ -1082,7 +1085,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
@ -1103,10 +1106,10 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
WHERE MBROverlaps(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 8 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 8 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;
|
||||
@ -1125,7 +1128,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)');
|
||||
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 1 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)
|
||||
4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
@ -1140,7 +1143,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
@ -1154,7 +1157,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
@ -1184,15 +1187,15 @@ c1 ST_Astext(c4)
|
||||
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
|
||||
WHERE MBRDisjoint(tab.c4, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 Using where
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 9 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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
@ -1223,7 +1226,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)');
|
||||
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 1 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))
|
||||
@ -1239,7 +1242,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
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
|
||||
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
|
||||
1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where
|
||||
SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1;
|
||||
c1 ST_Astext(c4)
|
||||
3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
|
@ -11,11 +11,11 @@ test.t1 analyze status OK
|
||||
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
|
||||
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
|
||||
1 SIMPLE t1 range g g 34 NULL 5 Using where
|
||||
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
|
||||
ST_astext(t1.g)
|
||||
POINT(1 1)
|
||||
POINT(1.5 1.5)
|
||||
POINT(1 1)
|
||||
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
|
||||
delete from t1 where MBRWithin(t1.g, @g1);
|
||||
check table t1;
|
||||
@ -61,9 +61,9 @@ name ST_AsText(square)
|
||||
small POLYGON((0 0,0 1,1 1,1 0,0 0))
|
||||
SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square);
|
||||
name ST_AsText(square)
|
||||
right3 POLYGON((3 0,3 2,5 2,5 0,3 0))
|
||||
up3 POLYGON((0 3,0 5,2 5,2 3,0 3))
|
||||
down3 POLYGON((0 -3,0 -1,2 -1,2 -3,0 -3))
|
||||
right3 POLYGON((3 0,3 2,5 2,5 0,3 0))
|
||||
left3 POLYGON((-3 0,-3 2,-1 2,-1 0,-3 0))
|
||||
SELECT name, ST_AsText(square) from t1 where MBREquals(@p, square);
|
||||
name ST_AsText(square)
|
||||
@ -157,11 +157,11 @@ test.t1 analyze status OK
|
||||
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
|
||||
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
|
||||
1 SIMPLE t1 range g g 34 NULL 5 Using where
|
||||
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
|
||||
ST_astext(t1.g)
|
||||
POINT(1 1)
|
||||
POINT(1.5 1.5)
|
||||
POINT(1 1)
|
||||
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
|
||||
delete from t1 where MBRWithin(t1.g, @g1);
|
||||
check table t1;
|
||||
|
@ -11,11 +11,11 @@ test.t1 analyze status OK
|
||||
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
|
||||
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
|
||||
1 SIMPLE t1 range g g 34 NULL 5 Using where
|
||||
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
|
||||
ST_astext(t1.g)
|
||||
POINT(1 1)
|
||||
POINT(1.5 1.5)
|
||||
POINT(1 1)
|
||||
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
|
||||
delete from t1 where MBRWithin(t1.g, @g1);
|
||||
check table t1;
|
||||
@ -63,10 +63,10 @@ name ST_AsText(square)
|
||||
small POLYGON((0 0,0 1,1 1,1 0,0 0))
|
||||
SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square);
|
||||
name ST_AsText(square)
|
||||
up3 POLYGON((0 3,0 5,2 5,2 3,0 3))
|
||||
down3 POLYGON((0 -3,0 -1,2 -1,2 -3,0 -3))
|
||||
right3 POLYGON((3 0,3 2,5 2,5 0,3 0))
|
||||
left3 POLYGON((-3 0,-3 2,-1 2,-1 0,-3 0))
|
||||
right3 POLYGON((3 0,3 2,5 2,5 0,3 0))
|
||||
up3 POLYGON((0 3,0 5,2 5,2 3,0 3))
|
||||
SELECT name, ST_AsText(square) from t1 where MBREquals(@p, square);
|
||||
name ST_AsText(square)
|
||||
SELECT name, ST_AsText(square) from t1 where MBRIntersects(@p, square);
|
||||
|
Reference in New Issue
Block a user