1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-4750 follow-up: Reduce disabling innodb_stats_persistent

This essentially reverts commit 4e89ec6692
and only disables InnoDB persistent statistics for tests where it is
desirable. By design, InnoDB persistent statistics will not be updated
except by ANALYZE TABLE or by STATS_AUTO_RECALC.

The internal transactions that update persistent InnoDB statistics
in background tasks (with innodb_stats_auto_recalc=ON) may cause
nondeterministic query plans or interfere with some tests that deal
with other InnoDB internals, such as the purge of transaction history.
This commit is contained in:
Marko Mäkelä
2021-08-31 13:55:02 +03:00
parent 45a05fda27
commit 9608773f75
131 changed files with 2202 additions and 1789 deletions

View File

@ -1,5 +1,5 @@
# Copyright (c) 2007, 2013, Oracle and/or its affiliates # Copyright (c) 2007, 2013, Oracle and/or its affiliates
# Copyright (c) 2010, 2019, MariaDB Corporation # Copyright (c) 2010, 2021, MariaDB Corporation
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -54,7 +54,6 @@ loose-innodb_write_io_threads= 2
loose-innodb_read_io_threads= 2 loose-innodb_read_io_threads= 2
loose-innodb_log_buffer_size= 1M loose-innodb_log_buffer_size= 1M
loose-innodb_log_file_size= 10M loose-innodb_log_file_size= 10M
loose-innodb-stats-persistent= OFF
slave-net-timeout=120 slave-net-timeout=120

View File

@ -28,7 +28,7 @@ SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SH
connection thread1; connection thread1;
# should not crash # should not crash
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction Got one of the listed errors
connection thread2; connection thread2;
d d
disconnect thread2; disconnect thread2;

View File

@ -40,7 +40,7 @@ SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SH
connection thread1; connection thread1;
--echo # should not crash --echo # should not crash
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #crashes SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #crashes
connection thread2; connection thread2;

View File

@ -0,0 +1 @@
--skip-innodb-stats-persistent

View File

@ -1,4 +1,3 @@
drop table if exists t1,t2,t3;
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
INSERT INTO t2 VALUES(1),(2),(3); INSERT INTO t2 VALUES(1),(2),(3);
# #
@ -259,7 +258,8 @@ Note 1051 Unknown table 'test.t1,mysqltest2.t2'
create table test.t1 (i int) engine=myisam; create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1; create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock
@ -272,7 +272,8 @@ ERROR 42000: A table must have at least 1 column
show tables; show tables;
Tables_in_test Tables_in_test
t2 t2
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock
@ -281,14 +282,16 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
create or replace table mysqltest2.t2; create or replace table mysqltest2.t2;
ERROR 42000: A table must have at least 1 column ERROR 42000: A table must have at least 1 column
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
create table t1 (i int); create table t1 (i int);
drop table t1; drop table t1;
create table test.t1 (i int); create table test.t1 (i int);
create table mysqltest2.t2 like test.t1; create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock
@ -301,7 +304,8 @@ ERROR 42S21: Duplicate column name 'a'
show tables; show tables;
Tables_in_test Tables_in_test
t2 t2
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock
@ -310,14 +314,16 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2
create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a';
ERROR 42S21: Duplicate column name 'a' ERROR 42S21: Duplicate column name 'a'
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
create table t1 (i int); create table t1 (i int);
drop table t1; drop table t1;
create table test.t1 (i int) engine=innodb; create table test.t1 (i int) engine=innodb;
create table mysqltest2.t2 like test.t1; create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
@ -329,7 +335,8 @@ drop table test.t1,mysqltest2.t2;
create table test.t1 (i int) engine=aria transactional=1 checksum=1; create table test.t1 (i int) engine=aria transactional=1 checksum=1;
create table mysqltest2.t2 like test.t1; create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2
@ -424,7 +431,8 @@ drop view t1;
# #
create table t1 (a int); create table t1 (a int);
lock table t1 write, t2 read; lock table t1 write, t2 read;
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock
@ -432,7 +440,8 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
# MDL_SHARED_READ NULL Table metadata lock test t2 # MDL_SHARED_READ NULL Table metadata lock test t2
create or replace table t1 (i int); create or replace table t1 (i int);
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock
@ -440,7 +449,8 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
# MDL_SHARED_READ NULL Table metadata lock test t2 # MDL_SHARED_READ NULL Table metadata lock test t2
create or replace table t1 like t2; create or replace table t1 like t2;
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock
@ -448,7 +458,8 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
# MDL_SHARED_READ NULL Table metadata lock test t2 # MDL_SHARED_READ NULL Table metadata lock test t2
create or replace table t1 select 1 as f1; create or replace table t1 select 1 as f1;
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock # MDL_BACKUP_DML NULL Backup lock

View File

@ -4,9 +4,6 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_metadata_lock_info.inc --source include/have_metadata_lock_info.inc
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
# #
# Create help table # Create help table
@ -215,18 +212,21 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
--error ER_TABLE_MUST_HAVE_COLUMNS --error ER_TABLE_MUST_HAVE_COLUMNS
create or replace table test.t1; create or replace table test.t1;
show tables; show tables;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
--error ER_TABLE_MUST_HAVE_COLUMNS --error ER_TABLE_MUST_HAVE_COLUMNS
create or replace table mysqltest2.t2; create or replace table mysqltest2.t2;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
create table t1 (i int); create table t1 (i int);
drop table t1; drop table t1;
@ -235,18 +235,21 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
--error ER_DUP_FIELDNAME --error ER_DUP_FIELDNAME
create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a';
show tables; show tables;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
--error ER_DUP_FIELDNAME --error ER_DUP_FIELDNAME
create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a';
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
create table t1 (i int); create table t1 (i int);
drop table t1; drop table t1;
@ -255,7 +258,8 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
unlock tables; unlock tables;
drop table test.t1,mysqltest2.t2; drop table test.t1,mysqltest2.t2;
@ -264,7 +268,8 @@ create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
unlock tables; unlock tables;
drop table t1; drop table t1;
@ -344,19 +349,24 @@ create table t1 (a int);
lock table t1 write, t2 read; lock table t1 write, t2 read;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
create or replace table t1 (i int); create or replace table t1 (i int);
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
create or replace table t1 like t2; create or replace table t1 like t2;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
create or replace table t1 select 1 as f1; create or replace table t1 select 1 as f1;
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info
where table_name not like 'innodb_%_stats';
drop table t1; drop table t1;
unlock tables; unlock tables;

View File

@ -1 +1,2 @@
--default-storage-engine=MyISAM --default-storage-engine=MyISAM
--innodb-stats-persistent=OFF

View File

@ -1,3 +1,5 @@
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
# #
# MDEV-16917: do not use splitting for derived with join cache # MDEV-16917: do not use splitting for derived with join cache
# #
@ -241,3 +243,4 @@ set optimizer_switch='split_materialized=default';
set use_stat_tables=default; set use_stat_tables=default;
set optimizer_use_condition_selectivity=default; set optimizer_use_condition_selectivity=default;
# End of 10.3 tests # End of 10.3 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@ -2,6 +2,9 @@
--source include/default_optimizer_switch.inc --source include/default_optimizer_switch.inc
--source include/have_sequence.inc --source include/have_sequence.inc
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
--echo # --echo #
--echo # MDEV-16917: do not use splitting for derived with join cache --echo # MDEV-16917: do not use splitting for derived with join cache
--echo # --echo #
@ -193,3 +196,5 @@ set use_stat_tables=default;
set optimizer_use_condition_selectivity=default; set optimizer_use_condition_selectivity=default;
--echo # End of 10.3 tests --echo # End of 10.3 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@ -162,7 +162,8 @@ nothing
teststring teststring
teststring teststring
drop table t1; drop table t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb; create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb
stats_persistent=0;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1; check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text

View File

@ -74,7 +74,8 @@ drop table t1;
# Test InnoDB tables # Test InnoDB tables
# #
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb; create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb
stats_persistent=0;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1; check table t1;
select * from t1 where text1='teststring' or text1 like 'teststring_%'; select * from t1 where text1='teststring' or text1 like 'teststring_%';

View File

@ -3,6 +3,8 @@ set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization'; show variables like 'innodb_prefix_index_cluster_optimization';
Variable_name Value Variable_name Value
innodb_prefix_index_cluster_optimization ON innodb_prefix_index_cluster_optimization ON
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = OFF;
# Create a table with a large varchar field that we index the prefix # Create a table with a large varchar field that we index the prefix
# of and ensure we only trigger cluster lookups when we expect it. # of and ensure we only trigger cluster lookups when we expect it.
create table prefixinno ( create table prefixinno (
@ -455,3 +457,4 @@ blog_id
1 1
DROP TABLE wp_blogs; DROP TABLE wp_blogs;
SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt; SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;
SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent;

View File

@ -4,6 +4,9 @@ SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization;
set global innodb_prefix_index_cluster_optimization = ON; set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization'; show variables like 'innodb_prefix_index_cluster_optimization';
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = OFF;
--echo # Create a table with a large varchar field that we index the prefix --echo # Create a table with a large varchar field that we index the prefix
--echo # of and ensure we only trigger cluster lookups when we expect it. --echo # of and ensure we only trigger cluster lookups when we expect it.
create table prefixinno ( create table prefixinno (
@ -717,3 +720,4 @@ AND path IN ( '/fondsinvesteringer/', '/' );
DROP TABLE wp_blogs; DROP TABLE wp_blogs;
SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt; SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;
SET GLOBAL innodb_stats_persistent = @save_innodb_stats_persistent;

View File

@ -6,6 +6,8 @@ SET DEFAULT_STORAGE_ENGINE = InnoDB;
set @optimizer_switch_save= @@optimizer_switch; set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='index_merge_sort_intersection=off'; set optimizer_switch='index_merge_sort_intersection=off';
set optimizer_switch='rowid_filter=off'; set optimizer_switch='rowid_filter=off';
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
#---------------- Index merge test 2 ------------------------------------------- #---------------- Index merge test 2 -------------------------------------------
create table t1 create table t1
( (
@ -835,3 +837,4 @@ a b c
DROP TABLE t1; DROP TABLE t1;
SET sort_buffer_size= @save_sort_buffer_size; SET sort_buffer_size= @save_sort_buffer_size;
disconnect disable_purge; disconnect disable_purge;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -27,6 +27,9 @@ set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='index_merge_sort_intersection=off'; set optimizer_switch='index_merge_sort_intersection=off';
set optimizer_switch='rowid_filter=off'; set optimizer_switch='rowid_filter=off';
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
# The first two tests are disabled because of non deterministic explain output. # The first two tests are disabled because of non deterministic explain output.
# If include/index_merge1.inc can be enabled for InnoDB and all other # If include/index_merge1.inc can be enabled for InnoDB and all other
# storage engines, please remove the subtest for Bug#21277 from # storage engines, please remove the subtest for Bug#21277 from
@ -222,3 +225,4 @@ DROP TABLE t1;
SET sort_buffer_size= @save_sort_buffer_size; SET sort_buffer_size= @save_sort_buffer_size;
disconnect disable_purge; disconnect disable_purge;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -602,6 +602,17 @@ INSERT INTO t3 VALUES
(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''), (89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''), (93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009',''); (97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
ANALYZE TABLE t1,t2,t3;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze Warning Engine-independent statistics are not collected for column 'page_restrictions'
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze Warning Engine-independent statistics are not collected for column 'old_text'
test.t3 analyze Warning Engine-independent statistics are not collected for column 'old_flags'
test.t3 analyze status OK
EXPLAIN EXPLAIN
SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3 SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox' WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'

View File

@ -456,6 +456,7 @@ INSERT INTO t3 VALUES
(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''), (89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''), (93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009',''); (97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
ANALYZE TABLE t1,t2,t3;
EXPLAIN EXPLAIN

View File

@ -1,3 +1,5 @@
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20), CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
INDEX (name)) ENGINE=InnoDB; INDEX (name)) ENGINE=InnoDB;
CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11), CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
@ -515,3 +517,4 @@ UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c2 AND t2.c1 = 3 SET t1.c3 = RAND()*10;
COMMIT; COMMIT;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
DROP TABLE t1,t2; DROP TABLE t1,t2;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -4,6 +4,8 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/default_optimizer_switch.inc --source include/default_optimizer_switch.inc
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
# #
# Test for bug #17164: ORed FALSE blocked conversion of outer join into join # Test for bug #17164: ORed FALSE blocked conversion of outer join into join
@ -391,3 +393,4 @@ COMMIT;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
DROP TABLE t1,t2; DROP TABLE t1,t2;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -1969,7 +1969,7 @@ rename table mysql.global_priv_bak to mysql.global_priv;
# Check that mysql_upgrade can be run on mysqldump # Check that mysql_upgrade can be run on mysqldump
# of mysql schema from previous versions # of mysql schema from previous versions
# #
call mtr.add_suppression("innodb_table_stats has length mismatch in the column name table_name"); call mtr.add_suppression("innodb_(table|index)_stats has length mismatch in the column name table_name");
call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20."); call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20.");
# #
# Upgrade from version 5.5 # Upgrade from version 5.5

View File

@ -367,7 +367,7 @@ rename table mysql.global_priv_bak to mysql.global_priv;
--echo # --echo #
# The warning appears during mysql_upgrade, before the schema becomes consistent # The warning appears during mysql_upgrade, before the schema becomes consistent
call mtr.add_suppression("innodb_table_stats has length mismatch in the column name table_name"); call mtr.add_suppression("innodb_(table|index)_stats has length mismatch in the column name table_name");
# This comes from opening 10.6 sys.host_summary view that uses sys.format_time function, # This comes from opening 10.6 sys.host_summary view that uses sys.format_time function,
# on still inconsistent mysql.proc, in older versions # on still inconsistent mysql.proc, in older versions
call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20."); call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20.");

View File

@ -1,4 +1,5 @@
drop table if exists t0,t1,t2,t3; SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=OFF;
# #
# MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used # MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used
# #
@ -96,3 +97,4 @@ ORDER BY pk2 DESC LIMIT 21;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref key1 key1 55 const,const 1 Using where; Using index 1 SIMPLE t2 ref key1 key1 55 const,const 1 Using where; Using index
drop table t1, t2; drop table t1, t2;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -1,8 +1,7 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--disable_warnings SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
drop table if exists t0,t1,t2,t3; SET GLOBAL innodb_stats_persistent=OFF;
--enable_warnings
--echo # --echo #
--echo # MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used --echo # MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used
@ -96,3 +95,4 @@ ORDER BY pk2 DESC LIMIT 21;
drop table t1, t2; drop table t1, t2;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -1,5 +1,3 @@
DROP TABLE IF EXISTS t1,t2,t3,t4;
DROP DATABASE IF EXISTS world;
set names utf8; set names utf8;
CREATE DATABASE world; CREATE DATABASE world;
use world; use world;

View File

@ -2,11 +2,6 @@
--source include/default_charset.inc --source include/default_charset.inc
--source include/have_sequence.inc --source include/have_sequence.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4;
DROP DATABASE IF EXISTS world;
--enable_warnings
set names utf8; set names utf8;
CREATE DATABASE world; CREATE DATABASE world;
@ -1049,6 +1044,8 @@ INSERT INTO t1 VALUES
(0,99083,'all','jhjerdvdxboydmpefbiesqbyyvdftsidjtvulamazljx'), (0,99083,'all','jhjerdvdxboydmpefbiesqbyyvdftsidjtvulamazljx'),
(32767,99084,'s','flj'),(-4947,99085,'something','Vermont'), (32767,99084,'s','flj'),(-4947,99085,'something','Vermont'),
(0,99086,'cjfljhjerd','Washington'); (0,99086,'cjfljhjerd','Washington');
ANALYZE TABLE t1;
--enable_query_log --enable_query_log
--enable_result_log --enable_result_log

View File

@ -4,8 +4,6 @@ set @innodb_stats_persistent_sample_pages_save=
@@innodb_stats_persistent_sample_pages; @@innodb_stats_persistent_sample_pages;
set global innodb_stats_persistent= 1; set global innodb_stats_persistent= 1;
set global innodb_stats_persistent_sample_pages=100; set global innodb_stats_persistent_sample_pages=100;
DROP TABLE IF EXISTS t1,t2,t3,t4;
DROP DATABASE IF EXISTS world;
set names utf8; set names utf8;
CREATE DATABASE world; CREATE DATABASE world;
use world; use world;

View File

@ -1,4 +1,6 @@
SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
DROP DATABASE IF EXISTS dbt3_s001; DROP DATABASE IF EXISTS dbt3_s001;
CREATE DATABASE dbt3_s001; CREATE DATABASE dbt3_s001;
use dbt3_s001; use dbt3_s001;
@ -2144,13 +2146,14 @@ a b
drop table t1; drop table t1;
SET @@optimizer_switch=@save_optimizer_switch; SET @@optimizer_switch=@save_optimizer_switch;
set @@use_stat_tables=@save_use_stat_tables; set @@use_stat_tables=@save_use_stat_tables;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;
# #
# MDEV-18755: possible RORI-plan and possible plan with range filter # MDEV-18755: possible RORI-plan and possible plan with range filter
# #
create table t1 ( create table t1 (
pk int not null primary key, f1 varchar(10), f2 varchar(30), a int(10), pk int not null primary key, f1 varchar(10), f2 varchar(30), a int(10),
key (f1), key (f2) key (f1), key (f2)
) engine=innodb; ) engine=innodb stats_persistent=0;
insert into t1 values insert into t1 values
(2,'a','a',2),(3,'a','a',null),(4,'a','a',55),(5,'a','a',4),(6,'a','a',0), (2,'a','a',2),(3,'a','a',null),(4,'a','a',55),(5,'a','a',4),(6,'a','a',0),
(7,'a','a',1),(8,'a','a',4),(9,'a','a',null),(10,'a','a',0),(11,'a','a',0), (7,'a','a',1),(8,'a','a',4),(9,'a','a',null),(10,'a','a',0),(11,'a','a',0),
@ -2513,7 +2516,7 @@ timestamp timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (id), PRIMARY KEY (id),
KEY ixEventWhoisDomainDomain (domain), KEY ixEventWhoisDomainDomain (domain),
KEY ixEventWhoisDomainTimestamp (timestamp) KEY ixEventWhoisDomainTimestamp (timestamp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB STATS_PERSISTENT=0 DEFAULT CHARSET=utf8;
INSERT INTO t1 ( INSERT INTO t1 (
id, domain, registrant_name, registrant_organization, registrant_street1, id, domain, registrant_name, registrant_organization, registrant_street1,
registrant_street2, registrant_street3, registrant_street4, registrant_street5, registrant_street2, registrant_street3, registrant_street4, registrant_street5,

View File

@ -2,7 +2,13 @@
SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
--source rowid_filter.test --source rowid_filter.test
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;
--source include/have_sequence.inc --source include/have_sequence.inc
--echo # --echo #
@ -12,7 +18,7 @@ SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
create table t1 ( create table t1 (
pk int not null primary key, f1 varchar(10), f2 varchar(30), a int(10), pk int not null primary key, f1 varchar(10), f2 varchar(30), a int(10),
key (f1), key (f2) key (f1), key (f2)
) engine=innodb; ) engine=innodb stats_persistent=0;
insert into t1 values insert into t1 values
(2,'a','a',2),(3,'a','a',null),(4,'a','a',55),(5,'a','a',4),(6,'a','a',0), (2,'a','a',2),(3,'a','a',null),(4,'a','a',55),(5,'a','a',4),(6,'a','a',0),
@ -265,7 +271,7 @@ CREATE TABLE t1 (
PRIMARY KEY (id), PRIMARY KEY (id),
KEY ixEventWhoisDomainDomain (domain), KEY ixEventWhoisDomainDomain (domain),
KEY ixEventWhoisDomainTimestamp (timestamp) KEY ixEventWhoisDomainTimestamp (timestamp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB STATS_PERSISTENT=0 DEFAULT CHARSET=utf8;
INSERT INTO t1 ( INSERT INTO t1 (
id, domain, registrant_name, registrant_organization, registrant_street1, id, domain, registrant_name, registrant_organization, registrant_street1,

View File

@ -1,3 +1,5 @@
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB; SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
drop table if exists t1, t2, t3,t4; drop table if exists t1, t2, t3,t4;
create table t1 ( create table t1 (
@ -185,3 +187,4 @@ bb b--b 2 2
ccc c--c 2 2 ccc c--c 2 2
dddd d--d 2 2 dddd d--d 2 2
drop table t1; drop table t1;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -10,5 +10,9 @@
--source include/have_innodb.inc --source include/have_innodb.inc
let $engine_type= InnoDB; let $engine_type= InnoDB;
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
--source include/rowid_order.inc --source include/rowid_order.inc
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -1,6 +1,8 @@
SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch; set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on'; set optimizer_switch='extended_keys=on';
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
drop table if exists t0,t1,t2,t3; drop table if exists t0,t1,t2,t3;
select @@global.use_stat_tables; select @@global.use_stat_tables;
@@global.use_stat_tables @@global.use_stat_tables
@ -2153,3 +2155,4 @@ set use_stat_tables= @tmp_ust;
set optimizer_use_condition_selectivity= @tmp_oucs; set optimizer_use_condition_selectivity= @tmp_oucs;
set @@global.histogram_size=@save_histogram_size; set @@global.histogram_size=@save_histogram_size;
SET SESSION DEFAULT_STORAGE_ENGINE=DEFAULT; SET SESSION DEFAULT_STORAGE_ENGINE=DEFAULT;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -7,6 +7,8 @@ SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch; set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on'; set optimizer_switch='extended_keys=on';
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
--source selectivity.test --source selectivity.test
@ -233,3 +235,4 @@ set use_stat_tables= @tmp_ust;
set optimizer_use_condition_selectivity= @tmp_oucs; set optimizer_use_condition_selectivity= @tmp_oucs;
set @@global.histogram_size=@save_histogram_size; set @@global.histogram_size=@save_histogram_size;
SET SESSION DEFAULT_STORAGE_ENGINE=DEFAULT; SET SESSION DEFAULT_STORAGE_ENGINE=DEFAULT;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -1,7 +1,3 @@
set global innodb_stats_persistent= 1;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create table t1 ( create table t1 (
f1 bigint(20) default 0, f1 bigint(20) default 0,
f2 varchar(50) default '', f2 varchar(50) default '',
@ -49,7 +45,7 @@ f43 varchar(50) default '',
f44 varchar(50) default '', f44 varchar(50) default '',
f45 int(10) default 0, f45 int(10) default 0,
f46 tinyint(1) default 0 f46 tinyint(1) default 0
) engine=innodb row_format=dynamic; ) engine=innodb stats_persistent=1 row_format=dynamic;
insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
insert into t1 select * from t1; insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
@ -314,4 +310,3 @@ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f20 f21 f22 f
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
drop table t1; drop table t1;
set global innodb_stats_persistent= 0;

View File

@ -1,6 +1,4 @@
--source include/have_innodb.inc --source include/have_innodb.inc
set global innodb_stats_persistent= 1;
drop table if exists t1;
create table t1 ( create table t1 (
f1 bigint(20) default 0, f1 bigint(20) default 0,
f2 varchar(50) default '', f2 varchar(50) default '',
@ -48,8 +46,7 @@ create table t1 (
f44 varchar(50) default '', f44 varchar(50) default '',
f45 int(10) default 0, f45 int(10) default 0,
f46 tinyint(1) default 0 f46 tinyint(1) default 0
) engine=innodb row_format=dynamic; ) engine=innodb stats_persistent=1 row_format=dynamic;
insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
insert into t1 select * from t1; insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
@ -57,4 +54,3 @@ insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
select * from t1 where f2 in (select f2 from t1 group by f2 having count(distinct f3) = 1); select * from t1 where f2 in (select f2 from t1 group by f2 having count(distinct f3) = 1);
drop table t1; drop table t1;
set global innodb_stats_persistent= 0;

View File

@ -1,6 +1,7 @@
set @subselect_innodb_tmp=@@optimizer_switch; set @subselect_innodb_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
drop table if exists t1,t2,t3; SET @saved_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = OFF;
CREATE TABLE t1 CREATE TABLE t1
( (
FOLDERID VARCHAR(32)BINARY NOT NULL FOLDERID VARCHAR(32)BINARY NOT NULL
@ -663,3 +664,4 @@ execute stmt;
a b a b
drop table t1,t2; drop table t1,t2;
# End of 10.4 tests # End of 10.4 tests
SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;

View File

@ -4,9 +4,8 @@
# settings are not relevant. # settings are not relevant.
set @subselect_innodb_tmp=@@optimizer_switch; set @subselect_innodb_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
--disable_warnings SET @saved_stats_persistent = @@GLOBAL.innodb_stats_persistent;
drop table if exists t1,t2,t3; SET GLOBAL innodb_stats_persistent = OFF;
--enable_warnings
# #
# key field overflow test # key field overflow test
@ -662,3 +661,5 @@ execute stmt;
drop table t1,t2; drop table t1,t2;
--echo # End of 10.4 tests --echo # End of 10.4 tests
SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;

View File

@ -1,3 +1,5 @@
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
select 0 + b'1'; select 0 + b'1';
0 + b'1' 0 + b'1'
1 1
@ -34,7 +36,6 @@ select 0 + b'1111111111111111';
select 0 + b'1000000000000001'; select 0 + b'1000000000000001';
0 + b'1000000000000001' 0 + b'1000000000000001'
32769 32769
drop table if exists t1;
create table t1 (a bit(65)) engine=innodb; create table t1 (a bit(65)) engine=innodb;
ERROR 42000: Display width out of range for 'a' (max = 64) ERROR 42000: Display width out of range for 'a' (max = 64)
create table t1 (a bit(0)) engine=innodb; create table t1 (a bit(0)) engine=innodb;
@ -422,3 +423,4 @@ hex(f1) hex(f2)
0 0 0 0
0 0 0 0
drop table t1; drop table t1;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -1,4 +1,7 @@
--source include/have_innodb.inc --source include/have_innodb.inc
SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
# #
# testing of the BIT column type # testing of the BIT column type
# #
@ -16,10 +19,6 @@ select 0 + b'1000000000000000';
select 0 + b'1111111111111111'; select 0 + b'1111111111111111';
select 0 + b'1000000000000001'; select 0 + b'1000000000000001';
--disable_warnings
drop table if exists t1;
--enable_warnings
--error 1439 --error 1439
create table t1 (a bit(65)) engine=innodb; create table t1 (a bit(65)) engine=innodb;
@ -157,3 +156,5 @@ insert into t1 (f1) values (default);
insert into t1 values (b'',b''),('',''); insert into t1 values (b'',b''),('','');
select hex(f1), hex(f2) from t1; select hex(f1), hex(f2) from t1;
drop table t1; drop table t1;
SET GLOBAL innodb_stats_persistent=@save_stats_persistent;

View File

@ -1,4 +1,4 @@
create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=InnoDb; create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=InnoDB STATS_PERSISTENT=0;
create view v1 as select * from t1 where c2=2; create view v1 as select * from t1 where c2=2;
create trigger trg_t1 before update on t1 for each row create trigger trg_t1 before update on t1 for each row
begin begin

View File

@ -1,7 +1,7 @@
--source include/have_sequence.inc --source include/have_sequence.inc
--source include/have_innodb.inc --source include/have_innodb.inc
create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=InnoDb; create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=InnoDB STATS_PERSISTENT=0;
create view v1 as select * from t1 where c2=2; create view v1 as select * from t1 where c2=2;
delimiter /; delimiter /;
create trigger trg_t1 before update on t1 for each row create trigger trg_t1 before update on t1 for each row

View File

@ -1,3 +1,5 @@
SET @save_stats_auto_recalc=@@GLOBAL.innodb_stats_auto_recalc;
SET GLOBAL innodb_stats_auto_recalc=OFF;
set sql_mode=""; set sql_mode="";
SET NAMES 'utf8'; SET NAMES 'utf8';
# #
@ -6372,3 +6374,4 @@ ROLLBACK /* added by mysqlbinlog */;
# Cleanup. # Cleanup.
# #
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL innodb_stats_auto_recalc=@save_stats_auto_recalc;

View File

@ -12,6 +12,9 @@
--source include/have_innodb.inc --source include/have_innodb.inc
let $engine_type=InnoDB; let $engine_type=InnoDB;
SET @save_stats_auto_recalc=@@GLOBAL.innodb_stats_auto_recalc;
SET GLOBAL innodb_stats_auto_recalc=OFF;
# #
# The test case would also work with statement based or mixed mode logging. # The test case would also work with statement based or mixed mode logging.
# But this would require different result files. To handle this with the # But this would require different result files. To handle this with the
@ -22,3 +25,4 @@ let $engine_type=InnoDB;
--source include/mysqlbinlog_row_engine.inc --source include/mysqlbinlog_row_engine.inc
SET GLOBAL innodb_stats_auto_recalc=@save_stats_auto_recalc;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -203,7 +203,7 @@ INSERT INTO c ( col_time_nokey,col_datetime_nokey,col_varchar_nokey) values
('16:21:18.052408','2001-11-08 21:02:12.009395', 'x'), ('16:21:18.052408','2001-11-08 21:02:12.009395', 'x'),
('18:56:33.027423','2003-04-01 00:00:00', 'i'); ('18:56:33.027423','2003-04-01 00:00:00', 'i');
--replace_column 10 x 11 x --replace_column 9 x 10 x
EXPLAIN SELECT EXPLAIN SELECT
outr.col_time_key AS x outr.col_time_key AS x
FROM c as outr FROM c as outr

View File

@ -507,7 +507,7 @@ INSERT /*! IGNORE */ INTO cc (
(6, '2008-10-10', NULL, '2000-05-22 00:00:00', 'i'), (6, '2008-10-10', NULL, '2000-05-22 00:00:00', 'i'),
(8, '2002-01-19', '05:18:40.006865', '2009-02-12 00:00:00', 'v'); (8, '2002-01-19', '05:18:40.006865', '2009-02-12 00:00:00', 'v');
--replace_column 10 # 11 # --replace_column 9 # 10 #
EXPLAIN EXPLAIN
SELECT subquery2_t2.col_int_key AS subquery2_field1 SELECT subquery2_t2.col_int_key AS subquery2_field1
FROM (c AS subquery2_t1 RIGHT JOIN FROM (c AS subquery2_t1 RIGHT JOIN
@ -544,10 +544,10 @@ CREATE TABLE cc (
KEY (col_int_key) KEY (col_int_key)
); );
INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5); INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5);
--replace_column 10 # 11 # --replace_column 9 # 10 #
EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3; EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3;
SELECT pk FROM cc WHERE col_int_key > 3; SELECT pk FROM cc WHERE col_int_key > 3;
--replace_column 10 # 11 # --replace_column 9 # 10 #
EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1;
SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1;
DROP TABLE cc; DROP TABLE cc;
@ -601,7 +601,7 @@ INSERT INTO a (
ANALYZE TABLE a, c; ANALYZE TABLE a, c;
--replace_column 10 # --replace_column 9 #
--disable_warnings --disable_warnings
EXPLAIN EXPLAIN
SELECT SELECT
@ -675,7 +675,7 @@ col_varchar_nokey
(5, 'b'),(8,'m'),(7, 'j'),(2, 'v'); (5, 'b'),(8,'m'),(7, 'j'),(2, 'v');
ANALYZE TABLE c, cc; ANALYZE TABLE c, cc;
--replace_column 10 # --replace_column 9 #
--disable_warnings --disable_warnings
let query=SELECT let query=SELECT
@ -734,7 +734,7 @@ KEY cover_key1 (col_int, col_varchar_255_utf8_key));
INSERT INTO j(col_int, pk, col_varchar_10_utf8) VALUES(9, 1, '951910400'), INSERT INTO j(col_int, pk, col_varchar_10_utf8) VALUES(9, 1, '951910400'),
(-1934295040, 2, '1235025920'),(-584581120, 3, '-1176633344'),(3, 4, '1074462720'); (-1934295040, 2, '1235025920'),(-584581120, 3, '-1176633344'),(3, 4, '1074462720');
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT col_varchar_255_utf8_key FROM j ORDER BY 1; EXPLAIN SELECT col_varchar_255_utf8_key FROM j ORDER BY 1;
SELECT col_varchar_255_utf8_key FROM j ORDER BY col_varchar_255_utf8_key; SELECT col_varchar_255_utf8_key FROM j ORDER BY col_varchar_255_utf8_key;

View File

@ -29,20 +29,20 @@ select d,e from v1;
select is_updatable from information_schema.views where table_name='v1'; select is_updatable from information_schema.views where table_name='v1';
# view with different algorithms (explain output differs) # view with different algorithms (explain output differs)
--replace_column 10 X --replace_column 9 X
explain select d,e from v1; explain select d,e from v1;
create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1;
show create view v2; show create view v2;
--sorted_result --sorted_result
select d,e from v2; select d,e from v2;
--replace_column 10 X --replace_column 9 X
explain select d,e from v2; explain select d,e from v2;
# VIEW on VIEW test # VIEW on VIEW test
create view v3 (d,e) as select d*2, e*2 from v1; create view v3 (d,e) as select d*2, e*2 from v1;
--sorted_result --sorted_result
select * from v3; select * from v3;
--replace_column 10 X --replace_column 9 X
explain select * from v3; explain select * from v3;
drop view v1,v2,v3; drop view v1,v2,v3;
@ -58,7 +58,7 @@ insert into t1 (a) values (1), (2), (3), (1), (2), (3);
create view v1 as select distinct b from t1; create view v1 as select distinct b from t1;
--sorted_result --sorted_result
select * from v1; select * from v1;
--replace_column 10 X --replace_column 9 X
explain select * from v1; explain select * from v1;
--sorted_result --sorted_result
select * from t1; select * from t1;
@ -66,7 +66,7 @@ drop view v1;
create view v1 as select distinct c from t1; create view v1 as select distinct c from t1;
--sorted_result --sorted_result
select * from v1; select * from v1;
--replace_column 10 X --replace_column 9 X
explain select * from v1; explain select * from v1;
--sorted_result --sorted_result
select * from t1; select * from t1;
@ -82,13 +82,13 @@ create table t1 (a int not null,
insert into t1 (a) values (1), (2), (3), (4); insert into t1 (a) values (1), (2), (3), (4);
create view v1 as select b+1 from t1 order by 1 desc limit 2; create view v1 as select b+1 from t1 order by 1 desc limit 2;
select * from v1; select * from v1;
--replace_column 10 X --replace_column 9 X
explain select * from v1; explain select * from v1;
drop view v1; drop view v1;
create view v1 as select c+1 from t1 order by 1 desc limit 2; create view v1 as select c+1 from t1 order by 1 desc limit 2;
--sorted_result --sorted_result
select * from v1; select * from v1;
--replace_column 10 X --replace_column 9 X
explain select * from v1; explain select * from v1;
drop view v1; drop view v1;
drop table t1; drop table t1;

View File

@ -205,7 +205,7 @@ outr.col_varchar_nokey in ('c', 'x', 'i')
AND (outr.col_time_key IS NULL OR AND (outr.col_time_key IS NULL OR
outr.col_datetime_key = '2009-09-27'); outr.col_datetime_key = '2009-09-27');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE outr index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL 2 x 1 SIMPLE outr index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL x x
SELECT SELECT
outr.col_time_key AS x outr.col_time_key AS x
FROM c AS outr FROM c AS outr

View File

@ -205,7 +205,7 @@ outr.col_varchar_nokey in ('c', 'x', 'i')
AND (outr.col_time_key IS NULL OR AND (outr.col_time_key IS NULL OR
outr.col_datetime_key = '2009-09-27'); outr.col_datetime_key = '2009-09-27');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE outr index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL 2 x 1 SIMPLE outr index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL x x
SELECT SELECT
outr.col_time_key AS x outr.col_time_key AS x
FROM c AS outr FROM c AS outr

View File

@ -591,9 +591,9 @@ FROM (c AS subquery2_t1 RIGHT JOIN
(subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) (subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key))
ORDER BY subquery2_field1; ORDER BY subquery2_field1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE subquery2_t2 index NULL col_int_key_2 10 NULL 20 # 1 SIMPLE subquery2_t2 index NULL col_int_key_2 10 NULL # #
1 SIMPLE subquery2_t3 ALL NULL NULL NULL NULL 20 # 1 SIMPLE subquery2_t3 ALL NULL NULL NULL NULL # #
1 SIMPLE subquery2_t1 index NULL PRIMARY 4 NULL 20 # 1 SIMPLE subquery2_t1 index NULL PRIMARY 4 NULL # #
SELECT subquery2_t2.col_int_key AS subquery2_field1 SELECT subquery2_t2.col_int_key AS subquery2_field1
FROM (c AS subquery2_t1 RIGHT JOIN FROM (c AS subquery2_t1 RIGHT JOIN
(c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON (c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON
@ -794,7 +794,7 @@ KEY (col_int_key)
INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5); INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5);
EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3; EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cc range col_int_key col_int_key 5 NULL 3 # 1 SIMPLE cc range col_int_key col_int_key 5 NULL # #
SELECT pk FROM cc WHERE col_int_key > 3; SELECT pk FROM cc WHERE col_int_key > 3;
pk pk
5 5
@ -802,7 +802,7 @@ pk
3 3
EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cc range col_int_key col_int_key 5 NULL 3 # 1 SIMPLE cc range col_int_key col_int_key 5 NULL # #
SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1;
pk pk
3 3
@ -876,12 +876,12 @@ ON (table3.col_int_key = table2.col_int_key ) ) )
ON (table3.col_int_nokey = table2.pk ) ) ON (table3.col_int_nokey = table2.pk ) )
GROUP BY field1, field2; GROUP BY field1, field2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY table1 system NULL NULL NULL NULL 1 # 1 PRIMARY table1 system NULL NULL NULL NULL #
1 PRIMARY table2 ALL PRIMARY,col_int_key,col_int_key_2 NULL NULL NULL 19 # 1 PRIMARY table2 ALL PRIMARY,col_int_key,col_int_key_2 NULL NULL NULL # Using where
1 PRIMARY <derived2> ref key0 key0 9 test.table2.pk,test.table2.col_int_key 10 # 1 PRIMARY <derived2> ref key0 key0 9 test.table2.pk,test.table2.col_int_key #
2 DERIVED SUBQUERY1_t2 ALL PRIMARY,col_int_key,col_varchar_key,col_int_key_2 NULL NULL NULL 19 # 2 DERIVED SUBQUERY1_t2 ALL PRIMARY,col_int_key,col_varchar_key,col_int_key_2 NULL NULL NULL # Using where
2 DERIVED SUBQUERY1_t3 ref PRIMARY,col_varchar_key col_varchar_key 5 test.SUBQUERY1_t2.col_varchar_key 1 # 2 DERIVED SUBQUERY1_t3 ref PRIMARY,col_varchar_key col_varchar_key 5 test.SUBQUERY1_t2.col_varchar_key #
2 DERIVED SUBQUERY1_t1 ALL col_int_key,col_int_key_2 NULL NULL NULL 19 # 2 DERIVED SUBQUERY1_t1 ALL col_int_key,col_int_key_2 NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
SELECT SELECT
table1.pk AS field1 , table1.pk AS field1 ,
table1.col_datetime_key AS field2 table1.col_datetime_key AS field2
@ -955,10 +955,10 @@ GROUP BY SQ1_field1 , SQ1_field2
) )
GROUP BY field1; GROUP BY field1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 index NULL col_int_key_3 10 NULL 20 # 1 PRIMARY alias1 index NULL col_int_key_3 10 NULL # Using index; Using temporary; Using filesort
1 PRIMARY alias2 index NULL col_int_key_2 10 NULL 20 # 1 PRIMARY alias2 index NULL col_int_key_2 10 NULL # Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED SQ1_alias1 index col_int_key,col_int_key_2,col_int_key_3 col_int_key 5 NULL 20 # 2 MATERIALIZED SQ1_alias1 index col_int_key,col_int_key_2,col_int_key_3 col_int_key 5 NULL # Using index
2 MATERIALIZED SQ1_alias2 ALL NULL NULL NULL NULL 20 # 2 MATERIALIZED SQ1_alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join)
SELECT SELECT
alias2 . col_varchar_key AS field1 alias2 . col_varchar_key AS field1
FROM ( cc AS alias1 , cc AS alias2 ) FROM ( cc AS alias1 , cc AS alias2 )
@ -1018,7 +1018,7 @@ INSERT INTO j(col_int, pk, col_varchar_10_utf8) VALUES(9, 1, '951910400'),
(-1934295040, 2, '1235025920'),(-584581120, 3, '-1176633344'),(3, 4, '1074462720'); (-1934295040, 2, '1235025920'),(-584581120, 3, '-1176633344'),(3, 4, '1074462720');
EXPLAIN SELECT col_varchar_255_utf8_key FROM j ORDER BY 1; EXPLAIN SELECT col_varchar_255_utf8_key FROM j ORDER BY 1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE j index NULL cover_key1 773 NULL 4 # 1 SIMPLE j index NULL cover_key1 773 NULL # Using index; Using filesort
SELECT col_varchar_255_utf8_key FROM j ORDER BY col_varchar_255_utf8_key; SELECT col_varchar_255_utf8_key FROM j ORDER BY col_varchar_255_utf8_key;
col_varchar_255_utf8_key col_varchar_255_utf8_key
-117663334 -117663334

View File

@ -20,7 +20,7 @@ is_updatable
NO NO
explain select d,e from v1; explain select d,e from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X 1 SIMPLE t1 ALL NULL NULL NULL NULL X
create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1;
show create view v2; show create view v2;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
@ -34,8 +34,8 @@ d e
3 3 3 3
explain select d,e from v2; explain select d,e from v2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 5 X 2 DERIVED t1 ALL NULL NULL NULL NULL X
create view v3 (d,e) as select d*2, e*2 from v1; create view v3 (d,e) as select d*2, e*2 from v1;
select * from v3; select * from v3;
d e d e
@ -46,7 +46,7 @@ d e
6 6 6 6
explain select * from v3; explain select * from v3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X 1 SIMPLE t1 ALL NULL NULL NULL NULL X
drop view v1,v2,v3; drop view v1,v2,v3;
drop table t1; drop table t1;
create table t1 (a int not null, create table t1 (a int not null,
@ -61,8 +61,8 @@ b
-3 -3
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 6 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using temporary
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
@ -80,8 +80,8 @@ c
-3 -3
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 6 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using temporary
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
@ -103,8 +103,8 @@ b+1
-1 -1
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 4 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using filesort
drop view v1; drop view v1;
create view v1 as select c+1 from t1 order by 1 desc limit 2; create view v1 as select c+1 from t1 order by 1 desc limit 2;
select * from v1; select * from v1;
@ -113,8 +113,8 @@ c+1
0 0
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 4 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using filesort
drop view v1; drop view v1;
drop table t1; drop table t1;
create table t1 (a int, create table t1 (a int,

View File

@ -20,7 +20,7 @@ is_updatable
NO NO
explain select d,e from v1; explain select d,e from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X 1 SIMPLE t1 ALL NULL NULL NULL NULL X
create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1;
show create view v2; show create view v2;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
@ -34,8 +34,8 @@ d e
3 3 3 3
explain select d,e from v2; explain select d,e from v2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 5 X 2 DERIVED t1 ALL NULL NULL NULL NULL X
create view v3 (d,e) as select d*2, e*2 from v1; create view v3 (d,e) as select d*2, e*2 from v1;
select * from v3; select * from v3;
d e d e
@ -46,7 +46,7 @@ d e
6 6 6 6
explain select * from v3; explain select * from v3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 X 1 SIMPLE t1 ALL NULL NULL NULL NULL X
drop view v1,v2,v3; drop view v1,v2,v3;
drop table t1; drop table t1;
create table t1 (a int not null, create table t1 (a int not null,
@ -61,8 +61,8 @@ b
-3 -3
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 6 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using temporary
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
@ -80,8 +80,8 @@ c
-3 -3
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 6 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using temporary
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
@ -103,8 +103,8 @@ b+1
-1 -1
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 4 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using filesort
drop view v1; drop view v1;
create view v1 as select c+1 from t1 order by 1 desc limit 2; create view v1 as select c+1 from t1 order by 1 desc limit 2;
select * from v1; select * from v1;
@ -113,8 +113,8 @@ c+1
0 0
explain select * from v1; explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 X 1 PRIMARY <derived2> ALL NULL NULL NULL NULL X
2 DERIVED t1 ALL NULL NULL NULL NULL 4 X 2 DERIVED t1 ALL NULL NULL NULL NULL X Using filesort
drop view v1; drop view v1;
drop table t1; drop table t1;
create table t1 (a int, create table t1 (a int,

View File

@ -2,6 +2,8 @@ set default_storage_engine=innodb;
set @old_dbug=@@global.debug_dbug; set @old_dbug=@@global.debug_dbug;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @saved_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = OFF;
CREATE TABLE `t` ( CREATE TABLE `t` (
`a` BLOB, `a` BLOB,
`b` BLOB, `b` BLOB,
@ -206,3 +208,4 @@ connection default;
DROP TABLE t1, t2; DROP TABLE t1, t2;
set debug_sync=reset; set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;

View File

@ -8,6 +8,8 @@ set @old_dbug=@@global.debug_dbug;
# Ensure that the history list length will actually be decremented by purge. # Ensure that the history list length will actually be decremented by purge.
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @saved_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = OFF;
CREATE TABLE `t` ( CREATE TABLE `t` (
`a` BLOB, `a` BLOB,
@ -263,3 +265,4 @@ DROP TABLE t1, t2;
set debug_sync=reset; set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;

View File

@ -17,7 +17,7 @@ innodb_saved_page_number_debug 0
connect stop_purge,localhost,root,,; connect stop_purge,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default; connection default;
create table t1 (f1 int primary key, f2 blob) engine=innodb; create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
start transaction; start transaction;
insert into t1 values(1, repeat('#',12)); insert into t1 values(1, repeat('#',12));
insert into t1 values(2, repeat('+',12)); insert into t1 values(2, repeat('+',12));

View File

@ -1,4 +1,6 @@
call mtr.add_suppression("InnoDB: Cannot add field .* in table"); call mtr.add_suppression("InnoDB: Cannot add field .* in table");
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
# Test 1) Show the page size from Information Schema # Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size'; WHERE LOWER(variable_name) = 'innodb_page_size';
@ -164,13 +166,15 @@ INSERT INTO t2 VALUES ('jejdkrun87'),('adfd72nh9k'),
CREATE TABLE t1(a int, b blob, c text, d text NOT NULL) CREATE TABLE t1(a int, b blob, c text, d text NOT NULL)
ENGINE=innodb DEFAULT CHARSET=utf8; ENGINE=innodb DEFAULT CHARSET=utf8;
INSERT INTO t1 INSERT INTO t1
SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3; SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3
ORDER BY a,d;
DROP TABLE t2, t3; DROP TABLE t2, t3;
SELECT COUNT(*) FROM t1 WHERE a=44; SELECT COUNT(*) FROM t1 WHERE a=44;
COUNT(*) COUNT(*)
5 5
SELECT a, SELECT a,
LENGTH(b),b=LEFT(REPEAT(d,100*a),65535),LENGTH(c),c=REPEAT(d,20*a),d FROM t1; LENGTH(b),b=LEFT(REPEAT(d,100*a),65535),LENGTH(c),c=REPEAT(d,20*a),d FROM t1
ORDER BY a,d;
a LENGTH(b) b=LEFT(REPEAT(d,100*a),65535) LENGTH(c) c=REPEAT(d,20*a) d a LENGTH(b) b=LEFT(REPEAT(d,100*a),65535) LENGTH(c) c=REPEAT(d,20*a) d
22 22000 1 4400 1 adfd72nh9k 22 22000 1 4400 1 adfd72nh9k
22 35200 1 7040 1 adfdijn0loKNHJik 22 35200 1 7040 1 adfdijn0loKNHJik
@ -211,7 +215,8 @@ SELECT COUNT(*) FROM t1 WHERE a=44;
COUNT(*) COUNT(*)
5 5
SELECT a, SELECT a,
LENGTH(b), b=LEFT(REPEAT(d,100*a), 65535),LENGTH(c), c=REPEAT(d,20*a), d FROM t1; LENGTH(b), b=LEFT(REPEAT(d,100*a), 65535),LENGTH(c), c=REPEAT(d,20*a), d FROM t1
ORDER BY a,d;
a LENGTH(b) b=LEFT(REPEAT(d,100*a), 65535) LENGTH(c) c=REPEAT(d,20*a) d a LENGTH(b) b=LEFT(REPEAT(d,100*a), 65535) LENGTH(c) c=REPEAT(d,20*a) d
22 22000 1 4400 1 adfd72nh9k 22 22000 1 4400 1 adfd72nh9k
22 35200 1 7040 1 adfdijn0loKNHJik 22 35200 1 7040 1 adfdijn0loKNHJik
@ -498,7 +503,9 @@ ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB
CREATE TABLE t1(c text, PRIMARY KEY (c(438))) CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
InnoDB 0 transactions not purged
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE tlong; DROP TABLE tlong;
DROP TABLE tlong2; DROP TABLE tlong2;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

View File

@ -1,3 +1,4 @@
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
call mtr.add_suppression("Innodb: Cannot add field.*row size is"); call mtr.add_suppression("Innodb: Cannot add field.*row size is");
# Test 1) Show the page size from Information Schema # Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status SELECT variable_value FROM information_schema.global_status
@ -283,6 +284,7 @@ Level Code Message
UPDATE t3 SET c = REPEAT('b',32800); UPDATE t3 SET c = REPEAT('b',32800);
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
InnoDB 0 transactions not purged
DROP TABLE t3; DROP TABLE t3;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE tlong; DROP TABLE tlong;

View File

@ -45,7 +45,7 @@ set DEBUG_SYNC="now WAIT_FOR default_signal";
disconnect con1; disconnect con1;
SHOW KEYS FROM t1; SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 1 f1 1 f1 A 2 NULL NULL BTREE NO t1 1 f1 1 f1 A # NULL NULL BTREE NO
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-25503 InnoDB hangs on startup during recovery # MDEV-25503 InnoDB hangs on startup during recovery

View File

@ -24,6 +24,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref my_d my_d 5 const 128 Using index 1 SIMPLE t1 ref my_d my_d 5 const 128 Using index
ALTER TABLE t1 DROP INDEX my_d; ALTER TABLE t1 DROP INDEX my_d;
ALTER TABLE t1 MODIFY COLUMN D INT; ALTER TABLE t1 MODIFY COLUMN D INT;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 ADD INDEX my_d (D); ALTER TABLE t1 ADD INDEX my_d (D);
EXPLAIN SELECT d FROM t1 WHERE d = 5; EXPLAIN SELECT d FROM t1 WHERE d = 5;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra

View File

@ -148,6 +148,9 @@ database_name table_name index_name last_update stat_name stat_value sample_size
test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1 test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1
test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index
test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE n_diff_pfx01 3 1 DB_ROW_ID
test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE size 1 NULL Number of pages in the index
connection con1; connection con1;
KILL QUERY @id; KILL QUERY @id;
ERROR 70100: Query execution was interrupted ERROR 70100: Query execution was interrupted

View File

@ -939,40 +939,40 @@ COUNT(*)
# #
EXPLAIN SELECT * FROM t1; EXPLAIN SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 # 1 SIMPLE t1 ALL NULL NULL NULL NULL #
EXPLAIN SELECT COUNT(*) FROM t1; EXPLAIN SELECT COUNT(*) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k2 5 NULL 12 Using index 1 SIMPLE t1 index NULL k2 5 NULL # Using index
EXPLAIN SELECT COUNT(c1) FROM t1; EXPLAIN SELECT COUNT(c1) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k2 5 NULL 12 Using index 1 SIMPLE t1 index NULL k2 5 NULL # Using index
EXPLAIN SELECT COUNT(c2) FROM t1; EXPLAIN SELECT COUNT(c2) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k2 5 NULL 12 # 1 SIMPLE t1 index NULL k2 5 NULL # Using index
EXPLAIN SELECT COUNT(c3) FROM t1; EXPLAIN SELECT COUNT(c3) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 # 1 SIMPLE t1 ALL NULL NULL NULL NULL #
EXPLAIN SELECT SUM(c1) FROM t1; EXPLAIN SELECT SUM(c1) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k2 5 NULL 12 # 1 SIMPLE t1 index NULL k2 5 NULL # Using index
EXPLAIN SELECT SUM(c2) FROM t1; EXPLAIN SELECT SUM(c2) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL k2 5 NULL 12 # 1 SIMPLE t1 index NULL k2 5 NULL # Using index
EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 # 1 SIMPLE t1 ALL NULL NULL NULL NULL #
EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 8 # 1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL # Using where
2 SUBQUERY t1 index NULL k2 5 NULL 12 # 2 SUBQUERY t1 index NULL k2 5 NULL # Using index
EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 8 # 1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL # Using where
2 SUBQUERY t1 index NULL k2 5 NULL 12 # 2 SUBQUERY t1 index NULL k2 5 NULL # Using index
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 7 # 1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL # Using where; Using index
2 SUBQUERY t1 index NULL k2 5 NULL 12 # 2 SUBQUERY t1 index NULL k2 5 NULL # Using index
# #
# Make all indexes in t2 obsolete to the active repeatable read transaction # Make all indexes in t2 obsolete to the active repeatable read transaction
# in the default connection. # in the default connection.
@ -1395,11 +1395,11 @@ disconnect con3;
CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY, CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY,
c2 INT NOT NULL DEFAULT 1, c2 INT NOT NULL DEFAULT 1,
c3 char(20) DEFAULT '', c3 char(20) DEFAULT '',
KEY c2_idx (c2)) ENGINE=InnoDB; KEY c2_idx (c2)) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1(c1) VALUES (1), (2), (3); INSERT INTO t1(c1) VALUES (1), (2), (3);
INSERT INTO t1(c1) SELECT c1 + 10 FROM t1; INSERT INTO t1(c1) SELECT c1 + 10 FROM t1;
INSERT INTO t1(c1) SELECT c1 + 100 FROM t1; INSERT INTO t1(c1) SELECT c1 + 100 FROM t1;
CREATE TABLE t2 SELECT * FROM t1; CREATE TABLE t2 STATS_PERSISTENT=0 SELECT * FROM t1;
EXPLAIN SELECT COUNT(*) FROM t1; EXPLAIN SELECT COUNT(*) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index 1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index

View File

@ -8,6 +8,7 @@ call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file");
call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Page for tablespace ");
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=");
call mtr.add_suppression("InnoDB: Unknown index id .* on page"); call mtr.add_suppression("InnoDB: Unknown index id .* on page");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
FLUSH TABLES; FLUSH TABLES;
SET GLOBAL innodb_file_per_table = 1; SET GLOBAL innodb_file_per_table = 1;
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;

View File

@ -1,5 +1,6 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\."); call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
FLUSH TABLES; FLUSH TABLES;
CREATE TABLE t1 CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY, (a INT AUTO_INCREMENT PRIMARY KEY,

View File

@ -45,7 +45,7 @@ level tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
KEY parent_id (parent_id), KEY parent_id (parent_id),
KEY level (level) KEY level (level)
) engine=innodb; ) engine=innodb stats_persistent=0;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
update t1 set parent_id=parent_id+100; update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102; select * from t1 where parent_id=102;

View File

@ -29,7 +29,7 @@ END~~
# Create a table with one record in it and start an RR transaction # Create a table with one record in it and start an RR transaction
# #
CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c)) CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c))
ENGINE=InnoDB; ENGINE=InnoDB STATS_PERSISTENT=0;
BEGIN; BEGIN;
SELECT * FROM t1; SELECT * FROM t1;
a b c a b c

View File

@ -1,6 +1,6 @@
select @@global.innodb_stats_persistent; select @@global.innodb_stats_persistent;
@@global.innodb_stats_persistent @@global.innodb_stats_persistent
0 1
set global innodb_defragment_stats_accuracy = 20; set global innodb_defragment_stats_accuracy = 20;
CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(256), KEY SECOND(a, b)) CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(256), KEY SECOND(a, b))
ENGINE=INNODB; ENGINE=INNODB;
@ -116,7 +116,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name = 't
count(stat_value) > 0 count(stat_value) > 0
1 1
# Clean up # Clean up
ALTER TABLE t2 STATS_PERSISTENT=1;
DROP TABLE t2; DROP TABLE t2;
select * from mysql.innodb_index_stats where table_name = 't2'; select * from mysql.innodb_index_stats where table_name = 't2';
database_name table_name index_name last_update stat_name stat_value sample_size stat_description database_name table_name index_name last_update stat_name stat_value sample_size stat_description

View File

@ -578,7 +578,7 @@ set global innodb_monitor_reset_all = default;
# Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL # Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL
# MONITORS # MONITORS
# #
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
LIKE 'buffer_page_written_index_leaf'; LIKE 'buffer_page_written_index_leaf';
NAME COUNT > 0 NAME COUNT > 0

View File

@ -2,7 +2,7 @@
# Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled # Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled
# correctly for InnoDB tables. # correctly for InnoDB tables.
# #
CREATE TABLE t (a INT) ENGINE=INNODB; CREATE TABLE t (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
SELECT update_time FROM information_schema.tables WHERE table_name = 't'; SELECT update_time FROM information_schema.tables WHERE table_name = 't';
update_time update_time
NULL NULL

View File

@ -38,7 +38,7 @@ connect (stop_purge,localhost,root,,);
START TRANSACTION WITH CONSISTENT SNAPSHOT; START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default; connection default;
create table t1 (f1 int primary key, f2 blob) engine=innodb; create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
start transaction; start transaction;
insert into t1 values(1, repeat('#',12)); insert into t1 values(1, repeat('#',12));

View File

@ -4,6 +4,8 @@
--source include/have_innodb_16k.inc --source include/have_innodb_16k.inc
call mtr.add_suppression("InnoDB: Cannot add field .* in table"); call mtr.add_suppression("InnoDB: Cannot add field .* in table");
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
@ -183,11 +185,13 @@ INSERT INTO t2 VALUES ('jejdkrun87'),('adfd72nh9k'),
CREATE TABLE t1(a int, b blob, c text, d text NOT NULL) CREATE TABLE t1(a int, b blob, c text, d text NOT NULL)
ENGINE=innodb DEFAULT CHARSET=utf8; ENGINE=innodb DEFAULT CHARSET=utf8;
INSERT INTO t1 INSERT INTO t1
SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3; SELECT a,LEFT(REPEAT(d,100*a),65535),REPEAT(d,20*a),d FROM t2,t3
ORDER BY a,d;
DROP TABLE t2, t3; DROP TABLE t2, t3;
SELECT COUNT(*) FROM t1 WHERE a=44; SELECT COUNT(*) FROM t1 WHERE a=44;
SELECT a, SELECT a,
LENGTH(b),b=LEFT(REPEAT(d,100*a),65535),LENGTH(c),c=REPEAT(d,20*a),d FROM t1; LENGTH(b),b=LEFT(REPEAT(d,100*a),65535),LENGTH(c),c=REPEAT(d,20*a),d FROM t1
ORDER BY a,d;
# in-place alter table should trigger ER_PRIMARY_CANT_HAVE_NULL # in-place alter table should trigger ER_PRIMARY_CANT_HAVE_NULL
--error ER_DUP_ENTRY --error ER_DUP_ENTRY
@ -200,7 +204,8 @@ CHECK TABLE t1;
ALTER TABLE t1 ADD PRIMARY KEY (a,b(255),c(255)), ADD KEY (b(767)); ALTER TABLE t1 ADD PRIMARY KEY (a,b(255),c(255)), ADD KEY (b(767));
SELECT COUNT(*) FROM t1 WHERE a=44; SELECT COUNT(*) FROM t1 WHERE a=44;
SELECT a, SELECT a,
LENGTH(b), b=LEFT(REPEAT(d,100*a), 65535),LENGTH(c), c=REPEAT(d,20*a), d FROM t1; LENGTH(b), b=LEFT(REPEAT(d,100*a), 65535),LENGTH(c), c=REPEAT(d,20*a), d FROM t1
ORDER BY a,d;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
CHECK TABLE t1; CHECK TABLE t1;
DROP TABLE t1; DROP TABLE t1;
@ -450,13 +455,11 @@ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
--source include/wait_all_purged.inc
DROP TABLE t1; DROP TABLE t1;
# The tests that uses these tables required the purge thread to run.
# Just in case it has not by now, provide a 10 second wait.
--sleep 10
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE tlong; DROP TABLE tlong;
DROP TABLE tlong2; DROP TABLE tlong2;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

View File

@ -3,6 +3,8 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_innodb_32k.inc --source include/have_innodb_32k.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
call mtr.add_suppression("Innodb: Cannot add field.*row size is"); call mtr.add_suppression("Innodb: Cannot add field.*row size is");
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
@ -334,13 +336,10 @@ UPDATE t3 SET c = REPEAT('b',16928);
SHOW WARNINGS; SHOW WARNINGS;
UPDATE t3 SET c = REPEAT('b',32800); UPDATE t3 SET c = REPEAT('b',32800);
SHOW WARNINGS; SHOW WARNINGS;
--source include/wait_all_purged.inc
DROP TABLE t3; DROP TABLE t3;
# The tests that uses these tables required the purge thread to run.
# Just in case it has not by now, provide a 10 second wait.
--sleep 10
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE tlong; DROP TABLE tlong;
DROP TABLE tlong2; DROP TABLE tlong2;

View File

@ -65,6 +65,7 @@ set DEBUG_SYNC="now WAIT_FOR default_signal";
--let $shutdown_timeout=0 --let $shutdown_timeout=0
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
disconnect con1; disconnect con1;
--replace_column 7 #
SHOW KEYS FROM t1; SHOW KEYS FROM t1;
DROP TABLE t1; DROP TABLE t1;
remove_files_wildcard $datadir/test #sql-*.frm; remove_files_wildcard $datadir/test #sql-*.frm;

View File

@ -24,6 +24,7 @@ EXPLAIN SELECT d FROM t1 WHERE d = 5;
EXPLAIN SELECT D FROM t1 WHERE D = 5; EXPLAIN SELECT D FROM t1 WHERE D = 5;
ALTER TABLE t1 DROP INDEX my_d; ALTER TABLE t1 DROP INDEX my_d;
ALTER TABLE t1 MODIFY COLUMN D INT; ALTER TABLE t1 MODIFY COLUMN D INT;
ANALYZE TABLE t1;
ALTER TABLE t1 ADD INDEX my_d (D); ALTER TABLE t1 ADD INDEX my_d (D);
EXPLAIN SELECT d FROM t1 WHERE d = 5; EXPLAIN SELECT d FROM t1 WHERE d = 5;
EXPLAIN SELECT D FROM t1 WHERE D = 5; EXPLAIN SELECT D FROM t1 WHERE D = 5;

View File

@ -0,0 +1 @@
--skip-innodb-stats-persistent

View File

@ -0,0 +1 @@
--skip-innodb-stats-persistent

View File

@ -162,28 +162,30 @@ COMMIT;
--echo # --echo #
--echo # Show The EXPLAIN output for these queries; --echo # Show The EXPLAIN output for these queries;
--echo # --echo #
# column 10 is the row count provided by handler::info(). In InnoDB, this is # column 9 is the row count provided by handler::info(). In InnoDB, this is
# a statistical estimate. After the multi-transactional changes above, # a statistical estimate. After the multi-transactional changes above,
# Solaris reports 10 rows which is correct, but other OSes report 9. # Solaris reports 10 rows which is correct, but other OSes report 9.
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT * FROM t1; EXPLAIN SELECT * FROM t1;
--replace_column 9 #
EXPLAIN SELECT COUNT(*) FROM t1; EXPLAIN SELECT COUNT(*) FROM t1;
--replace_column 9 #
EXPLAIN SELECT COUNT(c1) FROM t1; EXPLAIN SELECT COUNT(c1) FROM t1;
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT COUNT(c2) FROM t1; EXPLAIN SELECT COUNT(c2) FROM t1;
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT COUNT(c3) FROM t1; EXPLAIN SELECT COUNT(c3) FROM t1;
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT SUM(c1) FROM t1; EXPLAIN SELECT SUM(c1) FROM t1;
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT SUM(c2) FROM t1; EXPLAIN SELECT SUM(c2) FROM t1;
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
--echo # --echo #
@ -334,13 +336,13 @@ eval set global innodb_lock_wait_timeout=$initial_timeout;
CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY, CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY,
c2 INT NOT NULL DEFAULT 1, c2 INT NOT NULL DEFAULT 1,
c3 char(20) DEFAULT '', c3 char(20) DEFAULT '',
KEY c2_idx (c2)) ENGINE=InnoDB; KEY c2_idx (c2)) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1(c1) VALUES (1), (2), (3); INSERT INTO t1(c1) VALUES (1), (2), (3);
INSERT INTO t1(c1) SELECT c1 + 10 FROM t1; INSERT INTO t1(c1) SELECT c1 + 10 FROM t1;
INSERT INTO t1(c1) SELECT c1 + 100 FROM t1; INSERT INTO t1(c1) SELECT c1 + 100 FROM t1;
CREATE TABLE t2 SELECT * FROM t1; CREATE TABLE t2 STATS_PERSISTENT=0 SELECT * FROM t1;
let query1= SELECT COUNT(*) FROM t1; let query1= SELECT COUNT(*) FROM t1;
let query2= SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx); let query2= SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx);

View File

@ -1 +1 @@
--loose-innodb-sys-tablestats --loose-innodb-sys-tablestats --skip-innodb-stats-persistent

View File

@ -28,6 +28,7 @@ call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file");
call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Page for tablespace ");
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=");
call mtr.add_suppression("InnoDB: Unknown index id .* on page"); call mtr.add_suppression("InnoDB: Unknown index id .* on page");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
FLUSH TABLES; FLUSH TABLES;
let MYSQLD_DATADIR =`SELECT @@datadir`; let MYSQLD_DATADIR =`SELECT @@datadir`;

View File

@ -7,6 +7,8 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\."); call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
FLUSH TABLES; FLUSH TABLES;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`; let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;

View File

@ -79,7 +79,7 @@ CREATE TABLE t1 (
PRIMARY KEY (id), PRIMARY KEY (id),
KEY parent_id (parent_id), KEY parent_id (parent_id),
KEY level (level) KEY level (level)
) engine=innodb; ) engine=innodb stats_persistent=0;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
update t1 set parent_id=parent_id+100; update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102; select * from t1 where parent_id=102;

View File

@ -9,7 +9,7 @@
SET @innodb_stats_on_metadata_orig = @@innodb_stats_on_metadata; SET @innodb_stats_on_metadata_orig = @@innodb_stats_on_metadata;
CREATE TABLE bug57252 (a INT, KEY akey (a)) ENGINE=INNODB; CREATE TABLE bug57252 (a INT, KEY akey (a)) ENGINE=INNODB STATS_PERSISTENT=0;
BEGIN; BEGIN;
let $i = 10; let $i = 10;

View File

@ -36,7 +36,7 @@ DELIMITER ;~~
--echo # Create a table with one record in it and start an RR transaction --echo # Create a table with one record in it and start an RR transaction
--echo # --echo #
CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c)) CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c))
ENGINE=InnoDB; ENGINE=InnoDB STATS_PERSISTENT=0;
BEGIN; BEGIN;
SELECT * FROM t1; SELECT * FROM t1;

View File

@ -82,8 +82,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name = 't
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name = 't2' and stat_name in ('n_leaf_pages_defrag'); select count(stat_value) > 0 from mysql.innodb_index_stats where table_name = 't2' and stat_name in ('n_leaf_pages_defrag');
--echo # Clean up --echo # Clean up
# DROP TABLE will not touch persistent statistics if the table has none!
ALTER TABLE t2 STATS_PERSISTENT=1;
DROP TABLE t2; DROP TABLE t2;
select * from mysql.innodb_index_stats where table_name = 't2'; select * from mysql.innodb_index_stats where table_name = 't2';

View File

@ -1 +1 @@
--innodb-sys-tablestats --innodb-sys-tablestats --skip-innodb-stats-persistent

View File

@ -1,4 +1,6 @@
[redundant] [redundant]
innodb_default_row_format=redundant innodb_default_row_format=redundant
innodb_stats_persistent=off
[dynamic] [dynamic]
innodb_default_row_format=dynamic innodb_default_row_format=dynamic
innodb_stats_persistent=off

View File

@ -394,7 +394,7 @@ set global innodb_monitor_reset_all = default;
--echo # Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL --echo # Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL
--echo # MONITORS --echo # MONITORS
--echo # --echo #
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
let $innodb_monitor_enable = `SELECT @@innodb_monitor_enable`; let $innodb_monitor_enable = `SELECT @@innodb_monitor_enable`;

View File

@ -1,3 +1,4 @@
--innodb-sys-tablestats --innodb-sys-tablestats
--innodb_buffer_pool_size=5M --innodb_buffer_pool_size=5M
--innodb_monitor_enable=module_buffer --innodb_monitor_enable=module_buffer
--skip-innodb-stats-persistent

View File

@ -11,7 +11,7 @@
# This test is slow on buildbot. # This test is slow on buildbot.
--source include/big_test.inc --source include/big_test.inc
CREATE TABLE t (a INT) ENGINE=INNODB; CREATE TABLE t (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
SELECT update_time FROM information_schema.tables WHERE table_name = 't'; SELECT update_time FROM information_schema.tables WHERE table_name = 't';

View File

@ -55,6 +55,7 @@ DROP TABLE t1;
# MDEV-25663 Double free of transaction during TRUNCATE # MDEV-25663 Double free of transaction during TRUNCATE
# #
call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)");
call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions");
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB;
SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
TRUNCATE t1; TRUNCATE t1;

View File

@ -85,6 +85,7 @@ DROP TABLE t1;
--echo # MDEV-25663 Double free of transaction during TRUNCATE --echo # MDEV-25663 Double free of transaction during TRUNCATE
--echo # --echo #
call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)");
call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions");
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB;
SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; SET debug_dbug='+d,ib_create_table_fail_too_many_trx';

View File

@ -227,7 +227,7 @@ fid ST_AsText(ST_Envelope(g))
121 POLYGON((3 6,44 6,44 9,3 9,3 6)) 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 # 1 SIMPLE gis_geometry ALL NULL NULL NULL NULL # #
Warnings: Warnings:
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry` Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry`
SELECT fid, ST_X(g) FROM gis_point; SELECT fid, ST_X(g) FROM gis_point;
@ -244,7 +244,7 @@ fid ST_Y(g)
104 20 104 20
explain extended select ST_X(g),ST_Y(g) FROM gis_point; explain extended select ST_X(g),ST_Y(g) FROM gis_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 # 1 SIMPLE gis_point ALL NULL NULL NULL NULL # #
Warnings: Warnings:
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point` Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point`
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
@ -279,7 +279,7 @@ fid ST_IsClosed(g)
107 0 107 0
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_line ALL NULL NULL NULL NULL # #
Warnings: Warnings:
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line` Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line`
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon;
@ -309,7 +309,7 @@ fid ST_AsText(ST_InteriorRingN(g, 1))
110 NULL 110 NULL
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_polygon ALL NULL NULL NULL NULL # #
Warnings: Warnings:
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon` Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, ST_IsClosed(g) FROM gis_multi_line; SELECT fid, ST_IsClosed(g) FROM gis_multi_line;
@ -348,7 +348,7 @@ fid ST_NumGeometries(g)
121 2 121 2
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL # #
Warnings: Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point` Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
@ -376,7 +376,7 @@ fid ST_AsText(ST_GeometryN(g, 1))
121 POINT(44 6) 121 POINT(44 6)
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL # #
Warnings: Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point` Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second, SELECT g1.fid as first, g2.fid as second,
@ -395,8 +395,8 @@ MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g)
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 # Using temporary; Using filesort 1 SIMPLE g1 ALL NULL NULL NULL NULL # # Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 # Using join buffer (flat, BNL join) 1 SIMPLE g2 ALL NULL NULL NULL NULL # # Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;

View File

@ -1,5 +1,7 @@
SET default_storage_engine=InnoDB; SET default_storage_engine=InnoDB;
SET innodb_strict_mode=OFF; SET innodb_strict_mode=OFF;
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT) ENGINE=InnoDB; CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT) ENGINE=InnoDB;
CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING) ENGINE=InnoDB; CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING) ENGINE=InnoDB;
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON) ENGINE=InnoDB; CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON) ENGINE=InnoDB;
@ -179,39 +181,39 @@ CREATE UNIQUE INDEX idx2 on tab(c8(5) ASC) ;
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab ref idx1 idx1 8 const 1 # 1 SIMPLE tab ref idx1 idx1 8 const # Using where
#check index with WKB function #check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab ref idx1 idx1 8 const 1 # 1 SIMPLE tab ref idx1 idx1 8 const # Using where
#check index with WKT function #check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab ref idx3 idx3 8 const 1 # 1 SIMPLE tab ref idx3 idx3 8 const # Using where
#check index with WKB function #check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab FROM tab
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab ref idx3 idx3 8 const 1 # 1 SIMPLE tab ref idx3 idx3 8 const # Using where
#check index with WKT function #check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab const idx2 idx2 8 const 1 # 1 SIMPLE tab const idx2 idx2 8 const #
#check index with WKB function #check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab const idx2 idx2 8 const 1 # 1 SIMPLE tab const idx2 idx2 8 const #
#check index with DELETE operation #check index with DELETE operation
EXPLAIN DELETE FROM tab EXPLAIN DELETE FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab range idx2 idx2 8 NULL 1 # 1 SIMPLE tab range idx2 idx2 8 NULL # Using where
#check the spatial values #check the spatial values
SELECT ST_AsText(c1) FROM tab; SELECT ST_AsText(c1) FROM tab;
ST_AsText(c1) ST_AsText(c1)
@ -703,39 +705,39 @@ CREATE UNIQUE INDEX idx2 on tab3(c8(5) ASC) ;
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 ref idx1 idx1 8 const 1 # 1 SIMPLE tab3 ref idx1 idx1 8 const # Using where
#check index with WKB function #check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 ref idx1 idx1 8 const 1 # 1 SIMPLE tab3 ref idx1 idx1 8 const # Using where
#check index with WKT function #check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 ref idx3 idx3 8 const 1 # 1 SIMPLE tab3 ref idx3 idx3 8 const # Using where
#check index with WKB function #check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 FROM tab3
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 ref idx3 idx3 8 const 1 # 1 SIMPLE tab3 ref idx3 idx3 8 const # Using where
#check index with WKT function #check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 const idx2 idx2 8 const 1 # 1 SIMPLE tab3 const idx2 idx2 8 const #
#check index with WKB function #check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 const idx2 idx2 8 const 1 # 1 SIMPLE tab3 const idx2 idx2 8 const #
#check index with DELETE operation #check index with DELETE operation
EXPLAIN DELETE FROM tab3 EXPLAIN DELETE FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 range idx2 idx2 8 NULL 1 # 1 SIMPLE tab3 range idx2 idx2 8 NULL # Using where
#check the spatial values #check the spatial values
SELECT ST_AsText(c1) FROM tab3; SELECT ST_AsText(c1) FROM tab3;
ST_AsText(c1) ST_AsText(c1)
@ -783,12 +785,12 @@ tab3 CREATE TABLE `tab3` (
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 ref idx1 idx1 8 const 1 # 1 SIMPLE tab3 ref idx1 idx1 8 const # Using where
#check index with WKT function #check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab3 ref idx3 idx3 8 const 1 # 1 SIMPLE tab3 ref idx3 idx3 8 const # Using where
#check the Geometry property functions #check the Geometry property functions
SELECT fid, ST_Dimension(g) FROM gis_geometry; SELECT fid, ST_Dimension(g) FROM gis_geometry;
fid ST_Dimension(g) fid ST_Dimension(g)
@ -888,7 +890,7 @@ fid ST_AsText(ST_Envelope(g))
122 POLYGON((3 6,44 6,44 9,3 9,3 6)) 122 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 22 # 1 SIMPLE gis_geometry ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry` Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry`
#check Geometry point functions #check Geometry point functions
@ -906,7 +908,7 @@ fid ST_Y(g)
104 20 104 20
explain extended select ST_X(g),ST_Y(g) FROM gis_point; explain extended select ST_X(g),ST_Y(g) FROM gis_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 # 1 SIMPLE gis_point ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point` Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point`
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
@ -942,7 +944,7 @@ fid ST_IsClosed(g)
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)), explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),
ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_line ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line` Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line`
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon;
@ -973,7 +975,7 @@ fid ST_AsText(ST_InteriorRingN(g, 1))
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)), explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),
ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_polygon ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon` Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, ST_IsClosed(g) FROM gis_multi_line; SELECT fid, ST_IsClosed(g) FROM gis_multi_line;
@ -1013,7 +1015,7 @@ fid ST_NumGeometries(g)
122 2 122 2
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point` Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
@ -1043,7 +1045,7 @@ fid ST_AsText(ST_GeometryN(g, 1))
122 POINT(44 6) 122 POINT(44 6)
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point` Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second, SELECT g1.fid as first, g2.fid as second,
@ -1067,8 +1069,8 @@ MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g)
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE g1 ALL NULL NULL NULL NULL 3 # Using temporary; Using filesort 1 SIMPLE g1 ALL NULL NULL NULL NULL # 100.00 Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 3 # Using join buffer (flat, BNL join) 1 SIMPLE g2 ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
# check support of Foreign Key constraint # check support of Foreign Key constraint
@ -1113,3 +1115,4 @@ DROP TABLE tab,tab2,tab3,parent;
DROP PROCEDURE geominout; DROP PROCEDURE geominout;
DROP PROCEDURE geom_insert; DROP PROCEDURE geom_insert;
DROP PROCEDURE geom_cursor; DROP PROCEDURE geom_cursor;
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@ -1,5 +1,6 @@
SET default_storage_engine=InnoDB; SET default_storage_engine=InnoDB;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
@ -227,7 +228,7 @@ fid ST_AsText(ST_Envelope(g))
121 POLYGON((3 6,44 6,44 9,3 9,3 6)) 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 # 1 SIMPLE gis_geometry ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry` Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry`
SELECT fid, ST_X(g) FROM gis_point; SELECT fid, ST_X(g) FROM gis_point;
@ -244,7 +245,7 @@ fid ST_Y(g)
104 20 104 20
explain extended select ST_X(g),ST_Y(g) FROM gis_point; explain extended select ST_X(g),ST_Y(g) FROM gis_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 # 1 SIMPLE gis_point ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point` Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point`
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
@ -279,7 +280,7 @@ fid ST_IsClosed(g)
107 0 107 0
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_line ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line` Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line`
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon;
@ -309,7 +310,7 @@ fid ST_AsText(ST_InteriorRingN(g, 1))
110 NULL 110 NULL
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_polygon ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon` Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, ST_IsClosed(g) FROM gis_multi_line; SELECT fid, ST_IsClosed(g) FROM gis_multi_line;
@ -348,7 +349,7 @@ fid ST_NumGeometries(g)
121 2 121 2
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point` Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
@ -376,7 +377,7 @@ fid ST_AsText(ST_GeometryN(g, 1))
121 POINT(44 6) 121 POINT(44 6)
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 # 1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL # 100.00
Warnings: Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point` Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second, SELECT g1.fid as first, g2.fid as second,
@ -395,8 +396,8 @@ MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g)
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 # Using temporary; Using filesort 1 SIMPLE g1 ALL NULL NULL NULL NULL # 100.00 Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 # Using join buffer (flat, BNL join) 1 SIMPLE g2 ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
@ -1497,3 +1498,4 @@ COUNT(*)
1 1
DROP TABLE t1; DROP TABLE t1;
DROP DATABASE gis_ogs; DROP DATABASE gis_ogs;
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@ -25,7 +25,7 @@ INSERT INTO gis_point VALUES
(ST_PointFromText('POINT(100.32374832 101.23741821)'), ST_PointFromText('POINT(100.32374832 101.98527111)')); (ST_PointFromText('POINT(100.32374832 101.23741821)'), ST_PointFromText('POINT(100.32374832 101.98527111)'));
EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point GROUP BY p1, p2; EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point GROUP BY p1, p2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 # 1 SIMPLE gis_point ALL NULL NULL NULL NULL # Using temporary; Using filesort
SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point GROUP BY p1, p2; SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point GROUP BY p1, p2;
ST_AsText(p1) ST_AsText(p2) ST_AsText(p1) ST_AsText(p2)
POINT(100.32374832 101.23741821) POINT(100.32374832 101.98527111) POINT(100.32374832 101.23741821) POINT(100.32374832 101.98527111)
@ -277,7 +277,7 @@ DROP TABLE t1;
# #
# Test when the POINT is on B-TREE # Test when the POINT is on B-TREE
# #
CREATE TABLE gis_point(fid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, p POINT, KEY(p)) ENGINE=InnoDB; CREATE TABLE gis_point(fid INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, p POINT, KEY(p)) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO gis_point VALUES INSERT INTO gis_point VALUES
(101, ST_PointFromText('POINT(10 10)')), (101, ST_PointFromText('POINT(10 10)')),
(102, ST_PointFromText('POINT(20 10)')), (102, ST_PointFromText('POINT(20 10)')),
@ -302,7 +302,7 @@ INSERT INTO gis_point VALUES
'The ORDER BY will use filesort' 'The ORDER BY will use filesort'
EXPLAIN SELECT ST_AsText(p) FROM gis_point ORDER BY p; EXPLAIN SELECT ST_AsText(p) FROM gis_point ORDER BY p;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 10 # 1 SIMPLE gis_point ALL NULL NULL NULL NULL # Using filesort
SELECT ST_AsText(p) FROM gis_point ORDER BY p; SELECT ST_AsText(p) FROM gis_point ORDER BY p;
ST_AsText(p) ST_AsText(p)
POINT(10 10) POINT(10 10)
@ -1326,7 +1326,7 @@ test.gis_point check status OK
The ORDER BY for spatial index will use filesort The ORDER BY for spatial index will use filesort
EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 13 # 1 SIMPLE gis_point ALL NULL NULL NULL NULL # Using filesort
SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
ST_AsText(p1) ST_AsText(p2) ST_AsText(p1) ST_AsText(p2)
POINT(2 4) POINT(-2 -6) POINT(2 4) POINT(-2 -6)
@ -1488,7 +1488,7 @@ a ST_AsText(p) ST_AsText(l) ST_AsText(g)
2 POINT(20 20) LINESTRING(2 3,7 8,9 10,15 16) POLYGON((10 30,30 40,40 50,40 30,30 20,10 30)) 2 POINT(20 20) LINESTRING(2 3,7 8,9 10,15 16) POLYGON((10 30,30 40,40 50,40 30,30 20,10 30))
EXPLAIN UPDATE t1 SET p = ST_GeomFromText('POINT(30 30)') WHERE p = ST_GeomFromText('POINT(20 20)'); EXPLAIN UPDATE t1 SET p = ST_GeomFromText('POINT(30 30)') WHERE p = ST_GeomFromText('POINT(20 20)');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 27 NULL 1 # 1 SIMPLE t1 range PRIMARY PRIMARY 27 NULL # Using where
UPDATE t1 SET p = ST_GeomFromText('POINT(30 30)') WHERE p = ST_GeomFromText('POINT(20 20)'); UPDATE t1 SET p = ST_GeomFromText('POINT(30 30)') WHERE p = ST_GeomFromText('POINT(20 20)');
SELECT a, ST_AsText(p), ST_AsText(l), ST_AsText(g) FROM t1; SELECT a, ST_AsText(p), ST_AsText(l), ST_AsText(g) FROM t1;
a ST_AsText(p) ST_AsText(l) ST_AsText(g) a ST_AsText(p) ST_AsText(l) ST_AsText(g)
@ -1526,7 +1526,7 @@ ALTER TABLE t1 DROP PRIMARY KEY;
ALTER TABLE t1 ADD PRIMARY KEY(p); ALTER TABLE t1 ADD PRIMARY KEY(p);
EXPLAIN SELECT a, ST_AsText(p) FROM t1 WHERE a = 2 AND p = ST_GeomFromText('POINT(30 30)'); EXPLAIN SELECT a, ST_AsText(p) FROM t1 WHERE a = 2 AND p = ST_GeomFromText('POINT(30 30)');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY,idx2 PRIMARY 27 const 1 # 1 SIMPLE t1 const PRIMARY,idx2 PRIMARY 27 const #
SELECT a, ST_AsText(p) FROM t1 WHERE a = 2 AND p = ST_GeomFromText('POINT(30 30)'); SELECT a, ST_AsText(p) FROM t1 WHERE a = 2 AND p = ST_GeomFromText('POINT(30 30)');
a ST_AsText(p) a ST_AsText(p)
2 POINT(30 30) 2 POINT(30 30)

View File

@ -260,7 +260,7 @@ INSERT INTO gis_point VALUES
'The ORDER BY for spatial index will use filesort' 'The ORDER BY for spatial index will use filesort'
EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 13 # 1 SIMPLE gis_point ALL NULL NULL NULL NULL # Using filesort
SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
ST_AsText(p1) ST_AsText(p2) ST_AsText(p1) ST_AsText(p2)
POINT(2 4) POINT(-2 -6) POINT(2 4) POINT(-2 -6)

View File

@ -22,7 +22,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK test.t1 analyze status OK
EXPLAIN SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 140))')); EXPLAIN SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL gis_key NULL NULL NULL 150 # 1 SIMPLE t1 ALL gis_key NULL NULL NULL # Using where
SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')) ORDER BY fid; SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')) ORDER BY fid;
fid ST_AsText(g) fid ST_AsText(g)
1 LINESTRING(150 150,150 150) 1 LINESTRING(150 150,150 150)

View File

@ -33,7 +33,7 @@ GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(2 2,3 3))
CREATE INDEX i_p ON t_wl6455 (g(10)); CREATE INDEX i_p ON t_wl6455 (g(10));
EXPLAIN SELECT ST_AsText(g) FROM t_wl6455 WHERE g = POINT(2,2); EXPLAIN SELECT ST_AsText(g) FROM t_wl6455 WHERE g = POINT(2,2);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t_wl6455 ref i_p i_p 12 const 2 # 1 SIMPLE t_wl6455 ref i_p i_p 12 const # Using where
SELECT ST_AsText(g) FROM t_wl6455 WHERE g = POINT(2,2); SELECT ST_AsText(g) FROM t_wl6455 WHERE g = POINT(2,2);
ST_AsText(g) ST_AsText(g)
POINT(2 2) POINT(2 2)

View File

@ -91,12 +91,12 @@ SELECT fid, ST_Dimension(g) FROM gis_geometry;
SELECT fid, ST_GeometryType(g) FROM gis_geometry; SELECT fid, ST_GeometryType(g) FROM gis_geometry;
SELECT fid, ST_IsEmpty(g) FROM gis_geometry; SELECT fid, ST_IsEmpty(g) FROM gis_geometry;
SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry;
--replace_column 10 # --replace_column 9 # 10 #
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
SELECT fid, ST_X(g) FROM gis_point; SELECT fid, ST_X(g) FROM gis_point;
SELECT fid, ST_Y(g) FROM gis_point; SELECT fid, ST_Y(g) FROM gis_point;
--replace_column 10 # --replace_column 9 # 10 #
explain extended select ST_X(g),ST_Y(g) FROM gis_point; explain extended select ST_X(g),ST_Y(g) FROM gis_point;
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
@ -105,7 +105,7 @@ SELECT fid, ST_Length(g) FROM gis_line;
SELECT fid, ST_NumPoints(g) FROM gis_line; SELECT fid, ST_NumPoints(g) FROM gis_line;
SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line; SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line;
SELECT fid, ST_IsClosed(g) FROM gis_line; SELECT fid, ST_IsClosed(g) FROM gis_line;
--replace_column 10 # --replace_column 9 # 10 #
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon;
@ -113,7 +113,7 @@ SELECT fid, ST_Area(g) FROM gis_polygon;
SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon;
SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon; SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon;
SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
--replace_column 10 # --replace_column 9 # 10 #
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
SELECT fid, ST_IsClosed(g) FROM gis_multi_line; SELECT fid, ST_IsClosed(g) FROM gis_multi_line;
@ -125,7 +125,7 @@ SELECT fid, ST_NumGeometries(g) from gis_multi_point;
SELECT fid, ST_NumGeometries(g) from gis_multi_line; SELECT fid, ST_NumGeometries(g) from gis_multi_line;
SELECT fid, ST_NumGeometries(g) from gis_multi_polygon; SELECT fid, ST_NumGeometries(g) from gis_multi_polygon;
SELECT fid, ST_NumGeometries(g) from gis_geometrycollection; SELECT fid, ST_NumGeometries(g) from gis_geometrycollection;
--replace_column 10 # --replace_column 9 # 10 #
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
@ -133,7 +133,7 @@ SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_line;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection;
SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection; SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection;
--replace_column 10 # --replace_column 9 # 10 #
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
SELECT g1.fid as first, g2.fid as second, SELECT g1.fid as first, g2.fid as second,
@ -141,7 +141,7 @@ MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
--replace_column 10 # --replace_column 9 # 10 #
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,

View File

@ -14,6 +14,8 @@
SET default_storage_engine=InnoDB; SET default_storage_engine=InnoDB;
SET innodb_strict_mode=OFF; SET innodb_strict_mode=OFF;
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
# #
# Spatial objects # Spatial objects
@ -132,55 +134,55 @@ CREATE INDEX idx3 on tab(c3(5) ASC) USING BTREE;
CREATE UNIQUE INDEX idx2 on tab(c8(5) ASC) ; CREATE UNIQUE INDEX idx2 on tab(c8(5) ASC) ;
--echo #check equality predicate on the index columns --echo #check equality predicate on the index columns
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
--echo #check index with WKB function --echo #check index with WKB function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
--echo #check index with WKT function --echo #check index with WKT function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
--echo #check index with WKB function --echo #check index with WKB function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab FROM tab
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
--echo #check index with WKT function --echo #check index with WKT function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with WKB function --echo #check index with WKB function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
#--echo #check range predicate on the index columns #--echo #check range predicate on the index columns
#--replace_column 10 # #--replace_column 9 #
#--error ER_WRONG_ARGUMENTS #--error ER_WRONG_ARGUMENTS
#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab #EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
#WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); #WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
# #
#--replace_column 10 # #--replace_column 9 #
#--error ER_WRONG_ARGUMENTS #--error ER_WRONG_ARGUMENTS
#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab #EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
#WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); #WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
# #
#--replace_column 10 # #--replace_column 9 #
#--error ER_WRONG_ARGUMENTS #--error ER_WRONG_ARGUMENTS
#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab #EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
#WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); #WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with DELETE operation --echo #check index with DELETE operation
--replace_column 10 # --replace_column 9 #
EXPLAIN DELETE FROM tab EXPLAIN DELETE FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
@ -487,55 +489,55 @@ CREATE UNIQUE INDEX idx2 on tab3(c8(5) ASC) ;
--enable_warnings --enable_warnings
--echo #check equality predicate on the index columns --echo #check equality predicate on the index columns
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
--echo #check index with WKB function --echo #check index with WKB function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
--echo #check index with WKT function --echo #check index with WKT function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
--echo #check index with WKB function --echo #check index with WKB function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 FROM tab3
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
--echo #check index with WKT function --echo #check index with WKT function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with WKB function --echo #check index with WKB function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
# --echo #check range predicate on the index columns # --echo #check range predicate on the index columns
# --replace_column 10 # # --replace_column 9 #
# --error ER_WRONG_ARGUMENTS # --error ER_WRONG_ARGUMENTS
# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 # EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
# WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); # WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
# #
# --replace_column 10 # # --replace_column 9 #
# --error ER_WRONG_ARGUMENTS # --error ER_WRONG_ARGUMENTS
# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 # EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
# WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); # WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
# --replace_column 10 # # --replace_column 9 #
# --error ER_WRONG_ARGUMENTS # --error ER_WRONG_ARGUMENTS
# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 # EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
# WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); # WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with DELETE operation --echo #check index with DELETE operation
--replace_column 10 # --replace_column 9 #
EXPLAIN DELETE FROM tab3 EXPLAIN DELETE FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
@ -559,12 +561,12 @@ ALTER TABLE tab3 ROW_FORMAT=Dynamic;
SHOW CREATE TABLE tab3; SHOW CREATE TABLE tab3;
--echo #check index with WKB function --echo #check index with WKB function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
--echo #check index with WKT function --echo #check index with WKT function
--replace_column 10 # --replace_column 9 #
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
@ -575,13 +577,13 @@ SELECT fid, ST_Dimension(g) FROM gis_geometry;
SELECT fid, ST_GeometryType(g) FROM gis_geometry; SELECT fid, ST_GeometryType(g) FROM gis_geometry;
SELECT fid, ST_IsEmpty(g) FROM gis_geometry; SELECT fid, ST_IsEmpty(g) FROM gis_geometry;
SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry;
--replace_column 10 # --replace_column 9 #
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
--echo #check Geometry point functions --echo #check Geometry point functions
SELECT fid, ST_X(g) FROM gis_point; SELECT fid, ST_X(g) FROM gis_point;
SELECT fid, ST_Y(g) FROM gis_point; SELECT fid, ST_Y(g) FROM gis_point;
--replace_column 10 # --replace_column 9 #
explain extended select ST_X(g),ST_Y(g) FROM gis_point; explain extended select ST_X(g),ST_Y(g) FROM gis_point;
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
@ -590,7 +592,7 @@ SELECT fid, ST_Length(g) FROM gis_line;
SELECT fid, ST_NumPoints(g) FROM gis_line; SELECT fid, ST_NumPoints(g) FROM gis_line;
SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line; SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line;
SELECT fid, ST_IsClosed(g) FROM gis_line; SELECT fid, ST_IsClosed(g) FROM gis_line;
--replace_column 10 # --replace_column 9 #
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)), explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),
ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
@ -599,7 +601,7 @@ SELECT fid, ST_Area(g) FROM gis_polygon;
SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon;
SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon; SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon;
SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
--replace_column 10 # --replace_column 9 #
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)), explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),
ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
@ -612,7 +614,7 @@ SELECT fid, ST_NumGeometries(g) from gis_multi_point;
SELECT fid, ST_NumGeometries(g) from gis_multi_line; SELECT fid, ST_NumGeometries(g) from gis_multi_line;
SELECT fid, ST_NumGeometries(g) from gis_multi_polygon; SELECT fid, ST_NumGeometries(g) from gis_multi_polygon;
SELECT fid, ST_NumGeometries(g) from gis_geometrycollection; SELECT fid, ST_NumGeometries(g) from gis_geometrycollection;
--replace_column 10 # --replace_column 9 #
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
@ -620,7 +622,7 @@ SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_line;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection;
SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection; SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection;
--replace_column 10 # --replace_column 9 #
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
SELECT g1.fid as first, g2.fid as second, SELECT g1.fid as first, g2.fid as second,
@ -628,7 +630,7 @@ MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
--replace_column 10 # --replace_column 9 #
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
@ -680,3 +682,5 @@ DROP TABLE tab,tab2,tab3,parent;
DROP PROCEDURE geominout; DROP PROCEDURE geominout;
DROP PROCEDURE geom_insert; DROP PROCEDURE geom_insert;
DROP PROCEDURE geom_cursor; DROP PROCEDURE geom_cursor;
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@ -5,15 +5,13 @@
--source include/have_sequence.inc --source include/have_sequence.inc
SET default_storage_engine=InnoDB; SET default_storage_engine=InnoDB;
SET @save_innodb_stats_persistent=@@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent=0;
# #
# Spatial objects # Spatial objects
# #
--disable_warnings
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
--enable_warnings
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
@ -90,12 +88,12 @@ SELECT fid, ST_Dimension(g) FROM gis_geometry;
SELECT fid, ST_GeometryType(g) FROM gis_geometry; SELECT fid, ST_GeometryType(g) FROM gis_geometry;
SELECT fid, ST_IsEmpty(g) FROM gis_geometry; SELECT fid, ST_IsEmpty(g) FROM gis_geometry;
SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry; SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry;
--replace_column 10 # --replace_column 9 #
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry; explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
SELECT fid, ST_X(g) FROM gis_point; SELECT fid, ST_X(g) FROM gis_point;
SELECT fid, ST_Y(g) FROM gis_point; SELECT fid, ST_Y(g) FROM gis_point;
--replace_column 10 # --replace_column 9 #
explain extended select ST_X(g),ST_Y(g) FROM gis_point; explain extended select ST_X(g),ST_Y(g) FROM gis_point;
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line; SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
@ -104,7 +102,7 @@ SELECT fid, ST_Length(g) FROM gis_line;
SELECT fid, ST_NumPoints(g) FROM gis_line; SELECT fid, ST_NumPoints(g) FROM gis_line;
SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line; SELECT fid, ST_AsText(ST_PointN(g, 2)) FROM gis_line;
SELECT fid, ST_IsClosed(g) FROM gis_line; SELECT fid, ST_IsClosed(g) FROM gis_line;
--replace_column 10 # --replace_column 9 #
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line; explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon;
@ -112,7 +110,7 @@ SELECT fid, ST_Area(g) FROM gis_polygon;
SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon; SELECT fid, ST_AsText(ST_ExteriorRing(g)) FROM gis_polygon;
SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon; SELECT fid, ST_NumInteriorRings(g) FROM gis_polygon;
SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; SELECT fid, ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
--replace_column 10 # --replace_column 9 #
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon; explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
SELECT fid, ST_IsClosed(g) FROM gis_multi_line; SELECT fid, ST_IsClosed(g) FROM gis_multi_line;
@ -124,7 +122,7 @@ SELECT fid, ST_NumGeometries(g) from gis_multi_point;
SELECT fid, ST_NumGeometries(g) from gis_multi_line; SELECT fid, ST_NumGeometries(g) from gis_multi_line;
SELECT fid, ST_NumGeometries(g) from gis_multi_polygon; SELECT fid, ST_NumGeometries(g) from gis_multi_polygon;
SELECT fid, ST_NumGeometries(g) from gis_geometrycollection; SELECT fid, ST_NumGeometries(g) from gis_geometrycollection;
--replace_column 10 # --replace_column 9 #
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point; explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
@ -132,7 +130,7 @@ SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_line;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_polygon;
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection; SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_geometrycollection;
SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection; SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection;
--replace_column 10 # --replace_column 9 #
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point; explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
SELECT g1.fid as first, g2.fid as second, SELECT g1.fid as first, g2.fid as second,
@ -140,7 +138,7 @@ MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
--replace_column 10 # --replace_column 9 #
explain extended SELECT g1.fid as first, g2.fid as second, explain extended SELECT g1.fid as first, g2.fid as second,
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o, MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t, MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
@ -1443,3 +1441,5 @@ SELECT COUNT(*) FROM t1 WHERE MBRIntersects(GeomFromText('Polygon((0 0,0 10,10 1
DROP TABLE t1; DROP TABLE t1;
DROP DATABASE gis_ogs; DROP DATABASE gis_ogs;
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

Some files were not shown because too many files have changed in this diff Show More