| 1 |
CREATE PROCEDURE prepare_data(IN val INT) |
| 2 |
BEGIN |
| 3 |
DECLARE i INT DEFAULT 1; |
| 4 |
WHILE i < val DO |
| 5 |
INSERT INTO t1 (b) VALUES (i); |
| 6 |
SET i = i + 1; |
| 7 |
END WHILE; |
| 8 |
END| |
| 9 |
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT); |
| 10 |
SET GLOBAL innodb_monitor_enable = module_sampling; |
| 11 |
SELECT NAME,COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME='sampled_pages_read'; |
| 12 |
NAME COUNT |
| 13 |
sampled_pages_read 0 |
| 14 |
CALL prepare_data(30000); |
| 15 |
ANALYZE TABLE t1 UPDATE HISTOGRAM ON b WITH 50 BUCKETS; |
| 16 |
Table Op Msg_type Msg_text |
| 17 |
test.t1 histogram status Histogram statistics created for column 'b'. |
| 18 |
SELECT SCHEMA_NAME, TABLE_NAME, COLUMN_NAME FROM information_schema.column_statistics WHERE COLUMN_NAME = 'b'; |
| 19 |
SCHEMA_NAME TABLE_NAME COLUMN_NAME |
| 20 |
test t1 b |
| 21 |
DROP TABLE t1; |
| 22 |
SELECT NAME,COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE SUBSYSTEM='sampling'; |
| 23 |
NAME COUNT |
| 24 |
sampled_pages_read XX |
| 25 |
sampled_pages_skipped XX |
| 26 |
SET GLOBAL innodb_monitor_disable = module_sampling; |
| 27 |
SET GLOBAL innodb_monitor_reset_all = "module_sampling"; |
| 28 |
# |
| 29 |
# Cleanup |
| 30 |
# |
| 31 |
SET GLOBAL innodb_monitor_enable = default; |
| 32 |
Warnings: |
| 33 |
Warning 1230 Default value is not defined for this set option. Please specify correct counter or module name. |
| 34 |
SET GLOBAL innodb_monitor_disable = default; |
| 35 |
Warnings: |
| 36 |
Warning 1230 Default value is not defined for this set option. Please specify correct counter or module name. |
| 37 |
SET GLOBAL innodb_monitor_reset_all = default; |
| 38 |
Warnings: |
| 39 |
Warning 1230 Default value is not defined for this set option. Please specify correct counter or module name. |
| 40 |
DROP PROCEDURE prepare_data; |