1TRUNCATE TABLE test_innodb_stats; 2SELECT 'dummy INSERT, the table should be empty'; 3dummy INSERT, the table should be empty 4dummy INSERT, the table should be empty 5ANALYZE TABLE test_innodb_stats; 6Table Op Msg_type Msg_text 7test.test_innodb_stats analyze status OK 8SELECT 9stat_name, 10stat_value, 11sample_size, 12stat_description 13FROM mysql.innodb_index_stats 14WHERE 15database_name = DATABASE() AND 16table_name = 'test_innodb_stats' AND 17index_name = 'a_key' AND 18stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 19ORDER BY stat_name; 20stat_name n_diff_pfx01 21stat_value 0 22sample_size 1 23stat_description a 24stat_name n_diff_pfx02 25stat_value 0 26sample_size 1 27stat_description a,DB_ROW_ID 28stat_name n_leaf_pages 29stat_value 1 30sample_size NULL 31stat_description Number of leaf pages in the index 32stat_name size 33stat_value 1 34sample_size NULL 35stat_description Number of pages in the index 36FLUSH TABLE test_innodb_stats; 37SELECT * FROM information_schema.statistics 38WHERE table_name = 'test_innodb_stats'; 39TABLE_CATALOG def 40TABLE_SCHEMA test 41TABLE_NAME test_innodb_stats 42NON_UNIQUE 1 43INDEX_SCHEMA test 44INDEX_NAME a_key 45SEQ_IN_INDEX 1 46COLUMN_NAME a 47COLLATION A 48CARDINALITY 0 49SUB_PART NULL 50PACKED NULL 51NULLABLE YES 52INDEX_TYPE BTREE 53COMMENT 54INDEX_COMMENT 55TRUNCATE TABLE test_innodb_stats; 56INSERT INTO test_innodb_stats (a) VALUES (1); 57ANALYZE TABLE test_innodb_stats; 58Table Op Msg_type Msg_text 59test.test_innodb_stats analyze status OK 60SELECT 61stat_name, 62stat_value, 63sample_size, 64stat_description 65FROM mysql.innodb_index_stats 66WHERE 67database_name = DATABASE() AND 68table_name = 'test_innodb_stats' AND 69index_name = 'a_key' AND 70stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 71ORDER BY stat_name; 72stat_name n_diff_pfx01 73stat_value 1 74sample_size 1 75stat_description a 76stat_name n_diff_pfx02 77stat_value 1 78sample_size 1 79stat_description a,DB_ROW_ID 80stat_name n_leaf_pages 81stat_value 1 82sample_size NULL 83stat_description Number of leaf pages in the index 84stat_name size 85stat_value 1 86sample_size NULL 87stat_description Number of pages in the index 88FLUSH TABLE test_innodb_stats; 89SELECT * FROM information_schema.statistics 90WHERE table_name = 'test_innodb_stats'; 91TABLE_CATALOG def 92TABLE_SCHEMA test 93TABLE_NAME test_innodb_stats 94NON_UNIQUE 1 95INDEX_SCHEMA test 96INDEX_NAME a_key 97SEQ_IN_INDEX 1 98COLUMN_NAME a 99COLLATION A 100CARDINALITY 1 101SUB_PART NULL 102PACKED NULL 103NULLABLE YES 104INDEX_TYPE BTREE 105COMMENT 106INDEX_COMMENT 107TRUNCATE TABLE test_innodb_stats; 108INSERT INTO test_innodb_stats (a) VALUES (1), (1); 109ANALYZE TABLE test_innodb_stats; 110Table Op Msg_type Msg_text 111test.test_innodb_stats analyze status OK 112SELECT 113stat_name, 114stat_value, 115sample_size, 116stat_description 117FROM mysql.innodb_index_stats 118WHERE 119database_name = DATABASE() AND 120table_name = 'test_innodb_stats' AND 121index_name = 'a_key' AND 122stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 123ORDER BY stat_name; 124stat_name n_diff_pfx01 125stat_value 1 126sample_size 1 127stat_description a 128stat_name n_diff_pfx02 129stat_value 2 130sample_size 1 131stat_description a,DB_ROW_ID 132stat_name n_leaf_pages 133stat_value 1 134sample_size NULL 135stat_description Number of leaf pages in the index 136stat_name size 137stat_value 1 138sample_size NULL 139stat_description Number of pages in the index 140FLUSH TABLE test_innodb_stats; 141SELECT * FROM information_schema.statistics 142WHERE table_name = 'test_innodb_stats'; 143TABLE_CATALOG def 144TABLE_SCHEMA test 145TABLE_NAME test_innodb_stats 146NON_UNIQUE 1 147INDEX_SCHEMA test 148INDEX_NAME a_key 149SEQ_IN_INDEX 1 150COLUMN_NAME a 151COLLATION A 152CARDINALITY 2 153SUB_PART NULL 154PACKED NULL 155NULLABLE YES 156INDEX_TYPE BTREE 157COMMENT 158INDEX_COMMENT 159TRUNCATE TABLE test_innodb_stats; 160INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1); 161ANALYZE TABLE test_innodb_stats; 162Table Op Msg_type Msg_text 163test.test_innodb_stats analyze status OK 164SELECT 165stat_name, 166stat_value, 167sample_size, 168stat_description 169FROM mysql.innodb_index_stats 170WHERE 171database_name = DATABASE() AND 172table_name = 'test_innodb_stats' AND 173index_name = 'a_key' AND 174stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 175ORDER BY stat_name; 176stat_name n_diff_pfx01 177stat_value 1 178sample_size 1 179stat_description a 180stat_name n_diff_pfx02 181stat_value 3 182sample_size 1 183stat_description a,DB_ROW_ID 184stat_name n_leaf_pages 185stat_value 1 186sample_size NULL 187stat_description Number of leaf pages in the index 188stat_name size 189stat_value 1 190sample_size NULL 191stat_description Number of pages in the index 192FLUSH TABLE test_innodb_stats; 193SELECT * FROM information_schema.statistics 194WHERE table_name = 'test_innodb_stats'; 195TABLE_CATALOG def 196TABLE_SCHEMA test 197TABLE_NAME test_innodb_stats 198NON_UNIQUE 1 199INDEX_SCHEMA test 200INDEX_NAME a_key 201SEQ_IN_INDEX 1 202COLUMN_NAME a 203COLLATION A 204CARDINALITY 3 205SUB_PART NULL 206PACKED NULL 207NULLABLE YES 208INDEX_TYPE BTREE 209COMMENT 210INDEX_COMMENT 211TRUNCATE TABLE test_innodb_stats; 212INSERT INTO test_innodb_stats (a) VALUES (1), (1), (1), (1), (1), (1), (1), (1), (1), (1); 213ANALYZE TABLE test_innodb_stats; 214Table Op Msg_type Msg_text 215test.test_innodb_stats analyze status OK 216SELECT 217stat_name, 218stat_value, 219sample_size, 220stat_description 221FROM mysql.innodb_index_stats 222WHERE 223database_name = DATABASE() AND 224table_name = 'test_innodb_stats' AND 225index_name = 'a_key' AND 226stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 227ORDER BY stat_name; 228stat_name n_diff_pfx01 229stat_value 1 230sample_size 1 231stat_description a 232stat_name n_diff_pfx02 233stat_value 10 234sample_size 1 235stat_description a,DB_ROW_ID 236stat_name n_leaf_pages 237stat_value 1 238sample_size NULL 239stat_description Number of leaf pages in the index 240stat_name size 241stat_value 1 242sample_size NULL 243stat_description Number of pages in the index 244FLUSH TABLE test_innodb_stats; 245SELECT * FROM information_schema.statistics 246WHERE table_name = 'test_innodb_stats'; 247TABLE_CATALOG def 248TABLE_SCHEMA test 249TABLE_NAME test_innodb_stats 250NON_UNIQUE 1 251INDEX_SCHEMA test 252INDEX_NAME a_key 253SEQ_IN_INDEX 1 254COLUMN_NAME a 255COLLATION A 256CARDINALITY 2 257SUB_PART NULL 258PACKED NULL 259NULLABLE YES 260INDEX_TYPE BTREE 261COMMENT 262INDEX_COMMENT 263TRUNCATE TABLE test_innodb_stats; 264INSERT INTO test_innodb_stats (a) VALUES (1), (2); 265ANALYZE TABLE test_innodb_stats; 266Table Op Msg_type Msg_text 267test.test_innodb_stats analyze status OK 268SELECT 269stat_name, 270stat_value, 271sample_size, 272stat_description 273FROM mysql.innodb_index_stats 274WHERE 275database_name = DATABASE() AND 276table_name = 'test_innodb_stats' AND 277index_name = 'a_key' AND 278stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 279ORDER BY stat_name; 280stat_name n_diff_pfx01 281stat_value 2 282sample_size 1 283stat_description a 284stat_name n_diff_pfx02 285stat_value 2 286sample_size 1 287stat_description a,DB_ROW_ID 288stat_name n_leaf_pages 289stat_value 1 290sample_size NULL 291stat_description Number of leaf pages in the index 292stat_name size 293stat_value 1 294sample_size NULL 295stat_description Number of pages in the index 296FLUSH TABLE test_innodb_stats; 297SELECT * FROM information_schema.statistics 298WHERE table_name = 'test_innodb_stats'; 299TABLE_CATALOG def 300TABLE_SCHEMA test 301TABLE_NAME test_innodb_stats 302NON_UNIQUE 1 303INDEX_SCHEMA test 304INDEX_NAME a_key 305SEQ_IN_INDEX 1 306COLUMN_NAME a 307COLLATION A 308CARDINALITY 2 309SUB_PART NULL 310PACKED NULL 311NULLABLE YES 312INDEX_TYPE BTREE 313COMMENT 314INDEX_COMMENT 315TRUNCATE TABLE test_innodb_stats; 316INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2); 317ANALYZE TABLE test_innodb_stats; 318Table Op Msg_type Msg_text 319test.test_innodb_stats analyze status OK 320SELECT 321stat_name, 322stat_value, 323sample_size, 324stat_description 325FROM mysql.innodb_index_stats 326WHERE 327database_name = DATABASE() AND 328table_name = 'test_innodb_stats' AND 329index_name = 'a_key' AND 330stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 331ORDER BY stat_name; 332stat_name n_diff_pfx01 333stat_value 2 334sample_size 1 335stat_description a 336stat_name n_diff_pfx02 337stat_value 3 338sample_size 1 339stat_description a,DB_ROW_ID 340stat_name n_leaf_pages 341stat_value 1 342sample_size NULL 343stat_description Number of leaf pages in the index 344stat_name size 345stat_value 1 346sample_size NULL 347stat_description Number of pages in the index 348FLUSH TABLE test_innodb_stats; 349SELECT * FROM information_schema.statistics 350WHERE table_name = 'test_innodb_stats'; 351TABLE_CATALOG def 352TABLE_SCHEMA test 353TABLE_NAME test_innodb_stats 354NON_UNIQUE 1 355INDEX_SCHEMA test 356INDEX_NAME a_key 357SEQ_IN_INDEX 1 358COLUMN_NAME a 359COLLATION A 360CARDINALITY 3 361SUB_PART NULL 362PACKED NULL 363NULLABLE YES 364INDEX_TYPE BTREE 365COMMENT 366INDEX_COMMENT 367TRUNCATE TABLE test_innodb_stats; 368INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3); 369ANALYZE TABLE test_innodb_stats; 370Table Op Msg_type Msg_text 371test.test_innodb_stats analyze status OK 372SELECT 373stat_name, 374stat_value, 375sample_size, 376stat_description 377FROM mysql.innodb_index_stats 378WHERE 379database_name = DATABASE() AND 380table_name = 'test_innodb_stats' AND 381index_name = 'a_key' AND 382stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 383ORDER BY stat_name; 384stat_name n_diff_pfx01 385stat_value 3 386sample_size 1 387stat_description a 388stat_name n_diff_pfx02 389stat_value 3 390sample_size 1 391stat_description a,DB_ROW_ID 392stat_name n_leaf_pages 393stat_value 1 394sample_size NULL 395stat_description Number of leaf pages in the index 396stat_name size 397stat_value 1 398sample_size NULL 399stat_description Number of pages in the index 400FLUSH TABLE test_innodb_stats; 401SELECT * FROM information_schema.statistics 402WHERE table_name = 'test_innodb_stats'; 403TABLE_CATALOG def 404TABLE_SCHEMA test 405TABLE_NAME test_innodb_stats 406NON_UNIQUE 1 407INDEX_SCHEMA test 408INDEX_NAME a_key 409SEQ_IN_INDEX 1 410COLUMN_NAME a 411COLLATION A 412CARDINALITY 3 413SUB_PART NULL 414PACKED NULL 415NULLABLE YES 416INDEX_TYPE BTREE 417COMMENT 418INDEX_COMMENT 419TRUNCATE TABLE test_innodb_stats; 420INSERT INTO test_innodb_stats (a) VALUES (1), (1), (2), (3), (3); 421ANALYZE TABLE test_innodb_stats; 422Table Op Msg_type Msg_text 423test.test_innodb_stats analyze status OK 424SELECT 425stat_name, 426stat_value, 427sample_size, 428stat_description 429FROM mysql.innodb_index_stats 430WHERE 431database_name = DATABASE() AND 432table_name = 'test_innodb_stats' AND 433index_name = 'a_key' AND 434stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 435ORDER BY stat_name; 436stat_name n_diff_pfx01 437stat_value 3 438sample_size 1 439stat_description a 440stat_name n_diff_pfx02 441stat_value 5 442sample_size 1 443stat_description a,DB_ROW_ID 444stat_name n_leaf_pages 445stat_value 1 446sample_size NULL 447stat_description Number of leaf pages in the index 448stat_name size 449stat_value 1 450sample_size NULL 451stat_description Number of pages in the index 452FLUSH TABLE test_innodb_stats; 453SELECT * FROM information_schema.statistics 454WHERE table_name = 'test_innodb_stats'; 455TABLE_CATALOG def 456TABLE_SCHEMA test 457TABLE_NAME test_innodb_stats 458NON_UNIQUE 1 459INDEX_SCHEMA test 460INDEX_NAME a_key 461SEQ_IN_INDEX 1 462COLUMN_NAME a 463COLLATION A 464CARDINALITY 5 465SUB_PART NULL 466PACKED NULL 467NULLABLE YES 468INDEX_TYPE BTREE 469COMMENT 470INDEX_COMMENT 471TRUNCATE TABLE test_innodb_stats; 472INSERT INTO test_innodb_stats (a) VALUES (1), (2), (3), (4), (5), (1), (2), (3), (4), (5); 473ANALYZE TABLE test_innodb_stats; 474Table Op Msg_type Msg_text 475test.test_innodb_stats analyze status OK 476SELECT 477stat_name, 478stat_value, 479sample_size, 480stat_description 481FROM mysql.innodb_index_stats 482WHERE 483database_name = DATABASE() AND 484table_name = 'test_innodb_stats' AND 485index_name = 'a_key' AND 486stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size') 487ORDER BY stat_name; 488stat_name n_diff_pfx01 489stat_value 5 490sample_size 1 491stat_description a 492stat_name n_diff_pfx02 493stat_value 10 494sample_size 1 495stat_description a,DB_ROW_ID 496stat_name n_leaf_pages 497stat_value 1 498sample_size NULL 499stat_description Number of leaf pages in the index 500stat_name size 501stat_value 1 502sample_size NULL 503stat_description Number of pages in the index 504FLUSH TABLE test_innodb_stats; 505SELECT * FROM information_schema.statistics 506WHERE table_name = 'test_innodb_stats'; 507TABLE_CATALOG def 508TABLE_SCHEMA test 509TABLE_NAME test_innodb_stats 510NON_UNIQUE 1 511INDEX_SCHEMA test 512INDEX_NAME a_key 513SEQ_IN_INDEX 1 514COLUMN_NAME a 515COLLATION A 516CARDINALITY 10 517SUB_PART NULL 518PACKED NULL 519NULLABLE YES 520INDEX_TYPE BTREE 521COMMENT 522INDEX_COMMENT 523