mirror of
https://github.com/MariaDB/server.git
synced 2025-04-26 11:49:09 +03:00
Before commit 6112853cdab2770e92f9cfefdfef9c0a14b71cb7 in MySQL 4.1.1 introduced the parameter innodb_file_per_table, all InnoDB data was written to the InnoDB system tablespace (often named ibdata1). A serious design problem is that once the system tablespace has grown to some size, it cannot shrink even if the data inside it has been deleted. There are also other design problems, such as the server hang MDEV-29930 that should only be possible when using innodb_file_per_table=0 and innodb_undo_tablespaces=0 (storing both tables and undo logs in the InnoDB system tablespace). The parameter innodb_change_buffering was deprecated in commit b5852ffbeebc3000982988383daeefb0549e058a. Starting with commit baf276e6d4a44fe7cdf3b435c0153da0a42af2b6 (MDEV-19229) the number of innodb_undo_tablespaces can be increased, so that the undo logs can be moved out of the system tablespace of an existing installation. If all these things (tables, undo logs, and the change buffer) are removed from the InnoDB system tablespace, the only variable-size data structure inside it is the InnoDB data dictionary. DDL operations on .ibd files was optimized in commit 86dc7b4d4cfe15a2d37f8b5f60c4fce5dba9491d (MDEV-24626). That should have removed any thinkable performance advantage of using innodb_file_per_table=0. Since there should be no benefit of setting innodb_file_per_table=0, the parameter should be deprecated. Starting with MySQL 5.6 and MariaDB Server 10.0, the default value is innodb_file_per_table=1.
142 lines
2.6 KiB
Plaintext
142 lines
2.6 KiB
Plaintext
#
|
|
# wl#7277: InnoDB: Bulk Load for Create Index
|
|
#
|
|
|
|
-- source include/innodb_page_size_small.inc
|
|
|
|
# Create Insert Procedure
|
|
DELIMITER |;
|
|
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|
|
|
DELIMITER ;|
|
|
|
|
SELECT @@innodb_fill_factor;
|
|
|
|
# Test Compact Table
|
|
CREATE TABLE t1(
|
|
class INT,
|
|
id INT,
|
|
title VARCHAR(100)
|
|
) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
-- disable_query_log
|
|
CALL populate_t1();
|
|
-- enable_query_log
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
/* Create index. */
|
|
CREATE INDEX idx_id ON t1(id);
|
|
|
|
CREATE INDEX idx_title ON t1(title);
|
|
|
|
/* Check table. */
|
|
CHECK TABLE t1;
|
|
|
|
/* Select by index. */
|
|
EXPLAIN SELECT * FROM t1 WHERE id = 10;
|
|
EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
|
|
|
|
SELECT * FROM t1 WHERE id = 10;
|
|
SELECT * FROM t1 WHERE title = 'a10';
|
|
|
|
SELECT * FROM t1 WHERE id = 500;
|
|
SELECT * FROM t1 WHERE title = 'a500';
|
|
|
|
SELECT * FROM t1 WHERE id = 1000;
|
|
SELECT * FROM t1 WHERE title = 'a1000';
|
|
|
|
SELECT * FROM t1 WHERE id = 1010;
|
|
SELECT * FROM t1 WHERE title = 'a1010';
|
|
|
|
DROP TABLE t1;
|
|
|
|
# Test Blob
|
|
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;
|
|
|
|
SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1(
|
|
class INT,
|
|
id INT,
|
|
title VARCHAR(100)
|
|
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
|
|
|
|
-- disable_query_log
|
|
CALL populate_t1();
|
|
-- enable_query_log
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
/* Create index. */
|
|
CREATE INDEX idx_id ON t1(id);
|
|
|
|
CREATE INDEX idx_title ON t1(title);
|
|
|
|
/* Check table. */
|
|
CHECK TABLE t1;
|
|
|
|
/* Select by index. */
|
|
EXPLAIN SELECT * FROM t1 WHERE id = 10;
|
|
EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
|
|
|
|
SELECT * FROM t1 WHERE id = 10;
|
|
SELECT * FROM t1 WHERE title = 'a10';
|
|
|
|
SELECT * FROM t1 WHERE id = 500;
|
|
SELECT * FROM t1 WHERE title = 'a500';
|
|
|
|
SELECT * FROM t1 WHERE id = 1000;
|
|
SELECT * FROM t1 WHERE title = 'a1000';
|
|
|
|
SELECT * FROM t1 WHERE id = 1010;
|
|
SELECT * FROM t1 WHERE title = 'a1010';
|
|
|
|
DROP TABLE t1;
|
|
|
|
# Test Compression & Blob
|
|
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;
|
|
|
|
SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
|
|
|
|
DROP TABLE t1;
|
|
|
|
DROP PROCEDURE populate_t1;
|