Server IP : 172.67.216.182 / Your IP : 162.158.88.135 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/innodb/r/ |
Upload File : |
CREATE PROCEDURE populate_t1() BEGIN DECLARE i int DEFAULT 1; START TRANSACTION; WHILE (i <= 1000) DO INSERT INTO t1 VALUES (i, i, CONCAT('a', i)); SET i = i + 1; END WHILE; COMMIT; END| SELECT @@innodb_fill_factor; @@innodb_fill_factor 100 CREATE TABLE t1( class INT, id INT, title VARCHAR(100) ) ENGINE=InnoDB ROW_FORMAT=COMPACT; SELECT COUNT(*) FROM t1; COUNT(*) 1000 /* Create index. */ CREATE INDEX idx_id ON t1(id); CREATE INDEX idx_title ON t1(title); /* Check table. */ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 SELECT * FROM t1 WHERE title = 'a10'; class id title 10 10 a10 SELECT * FROM t1 WHERE id = 500; class id title 500 500 a500 SELECT * FROM t1 WHERE title = 'a500'; class id title 500 500 a500 SELECT * FROM t1 WHERE id = 1000; class id title 1000 1000 a1000 SELECT * FROM t1 WHERE title = 'a1000'; class id title 1000 1000 a1000 SELECT * FROM t1 WHERE id = 1010; class id title SELECT * FROM t1 WHERE title = 'a1010'; class id title DROP TABLE t1; CREATE TABLE t1( a INT PRIMARY KEY, b TEXT, c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT; INSERT INTO t1 VALUES (1, REPEAT('a',10000), 'a'), (2, REPEAT('b',20000), 'b'), (3, REPEAT('c',40000), 'c'), (4, REPEAT('d',60000), 'd'); ALTER TABLE t1 DROP COLUMN c; CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; CHAR_LENGTH(b) DROP TABLE t1; SET GLOBAL innodb_file_per_table=default; SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1( class INT, id INT, title VARCHAR(100) ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; SELECT COUNT(*) FROM t1; COUNT(*) 1000 /* Create index. */ CREATE INDEX idx_id ON t1(id); CREATE INDEX idx_title ON t1(title); /* Check table. */ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`id` = 10) EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`class` AS `class`,`test`.`t1`.`id` AS `id`,`test`.`t1`.`title` AS `title` from `test`.`t1` where (`test`.`t1`.`title` = 'a10') SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 SELECT * FROM t1 WHERE title = 'a10'; class id title 10 10 a10 SELECT * FROM t1 WHERE id = 500; class id title 500 500 a500 SELECT * FROM t1 WHERE title = 'a500'; class id title 500 500 a500 SELECT * FROM t1 WHERE id = 1000; class id title 1000 1000 a1000 SELECT * FROM t1 WHERE title = 'a1000'; class id title 1000 1000 a1000 SELECT * FROM t1 WHERE id = 1010; class id title SELECT * FROM t1 WHERE title = 'a1010'; class id title DROP TABLE t1; CREATE TABLE t1( a INT PRIMARY KEY, b TEXT, c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; INSERT INTO t1 VALUES (1, REPEAT('a',10000), 'a'), (2, REPEAT('b',20000), 'b'), (3, REPEAT('c',40000), 'c'), (4, REPEAT('d',60000), 'd'); ALTER TABLE t1 DROP COLUMN c; CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; CHAR_LENGTH(b) DROP TABLE t1; SET GLOBAL innodb_file_per_table=default; DROP PROCEDURE populate_t1;