Server IP : 104.21.38.3 / Your IP : 172.68.164.169 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 : |
# Test for Performance Schema. # To test the effect of disabling/enabling instrumentation for a table # in setup_objects table. --source include/not_embedded.inc --source include/have_perfschema.inc --disable_warnings drop table if exists test.setup_objects; --enable_warnings # Make sure only table io / table lock is instrumented and timed update performance_schema.setup_instruments set enabled='NO'; update performance_schema.setup_instruments set enabled='YES', timed='YES' where name in ('wait/io/table/sql/handler', 'wait/lock/table/sql/handler'); # Remove noise from previous tests truncate table performance_schema.table_io_waits_summary_by_table; truncate table performance_schema.table_lock_waits_summary_by_table; # Save the setup create table test.setup_objects as select * from performance_schema.setup_objects; truncate table performance_schema.setup_objects; select * from performance_schema.setup_objects; insert into performance_schema.setup_objects values ('TABLE', 'db1', 't1', 'YES', 'YES'); insert into performance_schema.setup_objects values ('TABLE', 'db1', 't2', 'YES', 'YES'); select * from performance_schema.setup_objects order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME; SET sql_mode = default; --disable_warnings drop database if exists db1; --enable_warnings create database db1; create table db1.t1 (a int, b char(10) default 'default', unique key uidx(a)); create table db1.t2 (a int, b char(10) default 'default'); # Insert some values in tables. insert into db1.t1 values('11', 'db1.t1'); insert into db1.t1 values('12', 'db1.t1'); insert into db1.t1 values('13', 'db1.t1'); insert into db1.t2 values('21', 'db1.t2'); insert into db1.t2 values('22', 'db1.t2'); insert into db1.t2 values('23', 'db1.t2'); # Query P_S tables. Stats should be updated. select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_lock_waits_summary_by_table where OBJECT_SCHEMA='db1'; select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_io_waits_summary_by_table where OBJECT_SCHEMA='db1'; truncate table db1.t1; truncate table db1.t2; # Query P_S tables. Stats should be updated. select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_lock_waits_summary_by_table where OBJECT_SCHEMA='db1'; select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_io_waits_summary_by_table where OBJECT_SCHEMA='db1'; # Disable instrumentation for db1.t1 update performance_schema.setup_objects set ENABLED='NO' where OBJECT_SCHEMA = 'db1' and OBJECT_NAME='t1'; # Query P_S tables. Stats for db1.t1 should have been removed while for db1.t2 it should have been preserved. select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_lock_waits_summary_by_table where OBJECT_SCHEMA='db1'; select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_io_waits_summary_by_table where OBJECT_SCHEMA='db1'; # Enable instrumentation for db1.t1 update performance_schema.setup_objects set ENABLED='YES' where OBJECT_SCHEMA = 'db1' and OBJECT_NAME='t1'; # Query P_S tables. Stats for db1.t1 should have been reset while for db1.t2 it should have been preserved. select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_lock_waits_summary_by_table where OBJECT_SCHEMA='db1'; select OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_READ, COUNT_WRITE from performance_schema.table_io_waits_summary_by_table where OBJECT_SCHEMA='db1'; truncate table performance_schema.setup_objects; select count(*) from performance_schema.setup_objects; drop database db1; # Restore the setup truncate table performance_schema.setup_objects; insert into performance_schema.setup_objects select * from test.setup_objects; drop table test.setup_objects; update performance_schema.setup_instruments set enabled='YES', timed='YES';