|
| 1 | +CREATE TABLE t ( |
| 2 | +a INT, |
| 3 | +b INT, |
| 4 | +c INT GENERATED ALWAYS AS(a+b), |
| 5 | +d INT GENERATED ALWAYS AS(a+b+b), |
| 6 | +KEY idxa (a), |
| 7 | +KEY vidxcd (c, d) |
| 8 | +) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; |
| 9 | +INSERT INTO t (a,b) VALUES (1, 2); |
| 10 | +SELECT index_name, stat_name, stat_description |
| 11 | +FROM mysql.innodb_index_stats |
| 12 | +WHERE database_name = 'test' AND table_name = 't'; |
| 13 | +index_name stat_name stat_description |
| 14 | +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 15 | +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 16 | +GEN_CLUST_INDEX size Number of pages in the index |
| 17 | +idxa n_diff_pfx01 a |
| 18 | +idxa n_diff_pfx02 a,DB_ROW_ID |
| 19 | +idxa n_leaf_pages Number of leaf pages in the index |
| 20 | +idxa size Number of pages in the index |
| 21 | +vidxcd n_diff_pfx01 c |
| 22 | +vidxcd n_diff_pfx02 c,d |
| 23 | +vidxcd n_diff_pfx03 c,d,DB_ROW_ID |
| 24 | +vidxcd n_leaf_pages Number of leaf pages in the index |
| 25 | +vidxcd size Number of pages in the index |
| 26 | +ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE; |
| 27 | +SELECT index_name, stat_name, stat_description |
| 28 | +FROM mysql.innodb_index_stats |
| 29 | +WHERE database_name = 'test' AND table_name = 't'; |
| 30 | +index_name stat_name stat_description |
| 31 | +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 32 | +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 33 | +GEN_CLUST_INDEX size Number of pages in the index |
| 34 | +idxa n_diff_pfx01 a |
| 35 | +idxa n_diff_pfx02 a,DB_ROW_ID |
| 36 | +idxa n_leaf_pages Number of leaf pages in the index |
| 37 | +idxa size Number of pages in the index |
| 38 | +idxb n_diff_pfx01 b |
| 39 | +idxb n_diff_pfx02 b,DB_ROW_ID |
| 40 | +idxb n_leaf_pages Number of leaf pages in the index |
| 41 | +idxb size Number of pages in the index |
| 42 | +vidxcd n_diff_pfx01 c |
| 43 | +vidxcd n_diff_pfx02 c,d |
| 44 | +vidxcd n_diff_pfx03 c,d,DB_ROW_ID |
| 45 | +vidxcd n_leaf_pages Number of leaf pages in the index |
| 46 | +vidxcd size Number of pages in the index |
| 47 | +ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; |
| 48 | +SELECT index_name, stat_name, stat_description |
| 49 | +FROM mysql.innodb_index_stats |
| 50 | +WHERE database_name = 'test' AND table_name = 't'; |
| 51 | +index_name stat_name stat_description |
| 52 | +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 53 | +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 54 | +GEN_CLUST_INDEX size Number of pages in the index |
| 55 | +idxb n_diff_pfx01 b |
| 56 | +idxb n_diff_pfx02 b,DB_ROW_ID |
| 57 | +idxb n_leaf_pages Number of leaf pages in the index |
| 58 | +idxb size Number of pages in the index |
| 59 | +vidxcd n_diff_pfx01 d |
| 60 | +vidxcd n_diff_pfx02 d,DB_ROW_ID |
| 61 | +vidxcd n_leaf_pages Number of leaf pages in the index |
| 62 | +vidxcd size Number of pages in the index |
| 63 | +ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; |
| 64 | +SELECT index_name, stat_name, stat_description |
| 65 | +FROM mysql.innodb_index_stats |
| 66 | +WHERE database_name = 'test' AND table_name = 't'; |
| 67 | +index_name stat_name stat_description |
| 68 | +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 69 | +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 70 | +GEN_CLUST_INDEX size Number of pages in the index |
| 71 | +idxb n_diff_pfx01 b |
| 72 | +idxb n_diff_pfx02 b,DB_ROW_ID |
| 73 | +idxb n_leaf_pages Number of leaf pages in the index |
| 74 | +idxb size Number of pages in the index |
| 75 | +vidxcd n_diff_pfx01 d |
| 76 | +vidxcd n_diff_pfx02 d,DB_ROW_ID |
| 77 | +vidxcd n_leaf_pages Number of leaf pages in the index |
| 78 | +vidxcd size Number of pages in the index |
| 79 | +vidxe n_diff_pfx01 e |
| 80 | +vidxe n_diff_pfx02 e,DB_ROW_ID |
| 81 | +vidxe n_leaf_pages Number of leaf pages in the index |
| 82 | +vidxe size Number of pages in the index |
| 83 | +ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; |
| 84 | +SELECT index_name, stat_name, stat_description |
| 85 | +FROM mysql.innodb_index_stats |
| 86 | +WHERE database_name = 'test' AND table_name = 't'; |
| 87 | +index_name stat_name stat_description |
| 88 | +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 89 | +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 90 | +GEN_CLUST_INDEX size Number of pages in the index |
| 91 | +idxb n_diff_pfx01 b |
| 92 | +idxb n_diff_pfx02 b,DB_ROW_ID |
| 93 | +idxb n_leaf_pages Number of leaf pages in the index |
| 94 | +idxb size Number of pages in the index |
| 95 | +vidxcd n_diff_pfx01 d |
| 96 | +vidxcd n_diff_pfx02 d,DB_ROW_ID |
| 97 | +vidxcd n_leaf_pages Number of leaf pages in the index |
| 98 | +vidxcd size Number of pages in the index |
| 99 | +vidxe n_diff_pfx01 e |
| 100 | +vidxe n_diff_pfx02 e,DB_ROW_ID |
| 101 | +vidxe n_leaf_pages Number of leaf pages in the index |
| 102 | +vidxe size Number of pages in the index |
| 103 | +vidxf n_diff_pfx01 f |
| 104 | +vidxf n_diff_pfx02 f,DB_ROW_ID |
| 105 | +vidxf n_leaf_pages Number of leaf pages in the index |
| 106 | +vidxf size Number of pages in the index |
| 107 | +ALTER TABLE t DROP INDEX vidxcd; |
| 108 | +SELECT index_name, stat_name, stat_description |
| 109 | +FROM mysql.innodb_index_stats |
| 110 | +WHERE database_name = 'test' AND table_name = 't'; |
| 111 | +index_name stat_name stat_description |
| 112 | +GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 113 | +GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 114 | +GEN_CLUST_INDEX size Number of pages in the index |
| 115 | +idxb n_diff_pfx01 b |
| 116 | +idxb n_diff_pfx02 b,DB_ROW_ID |
| 117 | +idxb n_leaf_pages Number of leaf pages in the index |
| 118 | +idxb size Number of pages in the index |
| 119 | +vidxe n_diff_pfx01 e |
| 120 | +vidxe n_diff_pfx02 e,DB_ROW_ID |
| 121 | +vidxe n_leaf_pages Number of leaf pages in the index |
| 122 | +vidxe size Number of pages in the index |
| 123 | +vidxf n_diff_pfx01 f |
| 124 | +vidxf n_diff_pfx02 f,DB_ROW_ID |
| 125 | +vidxf n_leaf_pages Number of leaf pages in the index |
| 126 | +vidxf size Number of pages in the index |
| 127 | +DROP TABLE t; |
0 commit comments