Server IP : 172.67.216.182 / Your IP : 172.71.124.155 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/perfschema/t/ |
Upload File : |
# Tests for PERFORMANCE_SCHEMA --source include/not_embedded.inc --source include/have_perfschema.inc --source include/have_query_cache_disabled.inc CREATE USER user1@localhost; CREATE USER user2@localhost; CREATE USER user3@localhost; grant ALL on *.* to user1@localhost; grant ALL on *.* to user2@localhost; grant ALL on *.* to user3@localhost; # To aggregate to accounts SET GLOBAL show_compatibility_56=0; TRUNCATE TABLE performance_schema.accounts; FLUSH PRIVILEGES; CREATE TABLE test.t_range(a int, b int, PRIMARY KEY(a)); INSERT INTO test.t_range values (1, 1), (2,2), (3, 3), (4, 4), (5, 5); INSERT INTO test.t_range values (6, 6), (7,7), (8, 8), (9, 9), (10, 10); FLUSH STATUS; let $initial= `SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'`; # Causes Select_range to increment (+1) SELECT * from test.t_range where (a >= 3) AND (a <= 5); SELECT * from performance_schema.session_status WHERE VARIABLE_NAME = 'Select_range'; --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log connect(con1, localhost, user1,,); # Causes Select_range to increment (+1) SELECT * from test.t_range where (a >= 3) AND (a <= 5); SELECT * from performance_schema.session_status WHERE VARIABLE_NAME = 'Select_range'; --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log connect(con2, localhost, user2,,); # Causes Select_range to increment (+2) SELECT * from test.t_range where (a >= 3) AND (a <= 5); SELECT * from test.t_range where (a >= 4) AND (a <= 6); SELECT * from performance_schema.session_status WHERE VARIABLE_NAME = 'Select_range'; --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log connect(con3, localhost, user3,,); # Causes Select_range to increment (+3) SELECT * from test.t_range where (a >= 3) AND (a <= 5); SELECT * from test.t_range where (a >= 4) AND (a <= 6); SELECT * from test.t_range where (a >= 5) AND (a <= 7); SELECT * from performance_schema.session_status WHERE VARIABLE_NAME = 'Select_range'; --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log --connection default --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log SELECT `USER`, `HOST`, VARIABLE_NAME, VARIABLE_VALUE FROM performance_schema.status_by_account WHERE VARIABLE_NAME = 'Select_range' AND `USER` LIKE 'user%' ORDER BY `USER`; --disconnect con1 --disconnect con2 # Wait till all disconnects are completed let $count_sessions= 2; --source include/wait_until_count_sessions.inc --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log TRUNCATE TABLE performance_schema.accounts; --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log --disconnect con3 # Wait till all disconnects are completed let $count_sessions= 1; --source include/wait_until_count_sessions.inc --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log # Make sure TRUNCATE on accounts does not add to global_status TRUNCATE TABLE performance_schema.accounts; --disable_query_log eval SELECT VARIABLE_NAME, (VARIABLE_VALUE - $initial) AS DELTA from performance_schema.global_status WHERE VARIABLE_NAME = 'Select_range'; --enable_query_log DROP TABLE test.t_range; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user2@localhost; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user3@localhost; DROP USER user1@localhost; DROP USER user2@localhost; DROP USER user3@localhost; SET GLOBAL show_compatibility_56=1; FLUSH PRIVILEGES;