| 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 count(*) from t; |
| 28 |
count(*) |
| 29 |
1 |
| 30 |
SELECT index_name, stat_name, stat_description |
| 31 |
FROM mysql.innodb_index_stats |
| 32 |
WHERE database_name = 'test' AND table_name = 't'; |
| 33 |
index_name stat_name stat_description |
| 34 |
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 35 |
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 36 |
GEN_CLUST_INDEX size Number of pages in the index |
| 37 |
idxa n_diff_pfx01 a |
| 38 |
idxa n_diff_pfx02 a,DB_ROW_ID |
| 39 |
idxa n_leaf_pages Number of leaf pages in the index |
| 40 |
idxa size Number of pages in the index |
| 41 |
idxb n_diff_pfx01 b |
| 42 |
idxb n_diff_pfx02 b,DB_ROW_ID |
| 43 |
idxb n_leaf_pages Number of leaf pages in the index |
| 44 |
idxb size Number of pages in the index |
| 45 |
vidxcd n_diff_pfx01 c |
| 46 |
vidxcd n_diff_pfx02 c,d |
| 47 |
vidxcd n_diff_pfx03 c,d,DB_ROW_ID |
| 48 |
vidxcd n_leaf_pages Number of leaf pages in the index |
| 49 |
vidxcd size Number of pages in the index |
| 50 |
ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE; |
| 51 |
select count(*) from t; |
| 52 |
count(*) |
| 53 |
1 |
| 54 |
SELECT index_name, stat_name, stat_description |
| 55 |
FROM mysql.innodb_index_stats |
| 56 |
WHERE database_name = 'test' AND table_name = 't'; |
| 57 |
index_name stat_name stat_description |
| 58 |
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 59 |
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 60 |
GEN_CLUST_INDEX size Number of pages in the index |
| 61 |
idxb n_diff_pfx01 b |
| 62 |
idxb n_diff_pfx02 b,DB_ROW_ID |
| 63 |
idxb n_leaf_pages Number of leaf pages in the index |
| 64 |
idxb size Number of pages in the index |
| 65 |
vidxcd n_diff_pfx01 d |
| 66 |
vidxcd n_diff_pfx02 d,DB_ROW_ID |
| 67 |
vidxcd n_leaf_pages Number of leaf pages in the index |
| 68 |
vidxcd size Number of pages in the index |
| 69 |
ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; |
| 70 |
select count(*) from t; |
| 71 |
count(*) |
| 72 |
1 |
| 73 |
SELECT index_name, stat_name, stat_description |
| 74 |
FROM mysql.innodb_index_stats |
| 75 |
WHERE database_name = 'test' AND table_name = 't'; |
| 76 |
index_name stat_name stat_description |
| 77 |
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 78 |
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 79 |
GEN_CLUST_INDEX size Number of pages in the index |
| 80 |
idxb n_diff_pfx01 b |
| 81 |
idxb n_diff_pfx02 b,DB_ROW_ID |
| 82 |
idxb n_leaf_pages Number of leaf pages in the index |
| 83 |
idxb size Number of pages in the index |
| 84 |
vidxcd n_diff_pfx01 d |
| 85 |
vidxcd n_diff_pfx02 d,DB_ROW_ID |
| 86 |
vidxcd n_leaf_pages Number of leaf pages in the index |
| 87 |
vidxcd size Number of pages in the index |
| 88 |
vidxe n_diff_pfx01 e |
| 89 |
vidxe n_diff_pfx02 e,DB_ROW_ID |
| 90 |
vidxe n_leaf_pages Number of leaf pages in the index |
| 91 |
vidxe size Number of pages in the index |
| 92 |
ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; |
| 93 |
select count(*) from t; |
| 94 |
count(*) |
| 95 |
1 |
| 96 |
SELECT index_name, stat_name, stat_description |
| 97 |
FROM mysql.innodb_index_stats |
| 98 |
WHERE database_name = 'test' AND table_name = 't'; |
| 99 |
index_name stat_name stat_description |
| 100 |
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 101 |
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 102 |
GEN_CLUST_INDEX size Number of pages in the index |
| 103 |
idxb n_diff_pfx01 b |
| 104 |
idxb n_diff_pfx02 b,DB_ROW_ID |
| 105 |
idxb n_leaf_pages Number of leaf pages in the index |
| 106 |
idxb size Number of pages in the index |
| 107 |
vidxcd n_diff_pfx01 d |
| 108 |
vidxcd n_diff_pfx02 d,DB_ROW_ID |
| 109 |
vidxcd n_leaf_pages Number of leaf pages in the index |
| 110 |
vidxcd size Number of pages in the index |
| 111 |
vidxe n_diff_pfx01 e |
| 112 |
vidxe n_diff_pfx02 e,DB_ROW_ID |
| 113 |
vidxe n_leaf_pages Number of leaf pages in the index |
| 114 |
vidxe size Number of pages in the index |
| 115 |
vidxf n_diff_pfx01 f |
| 116 |
vidxf n_diff_pfx02 f,DB_ROW_ID |
| 117 |
vidxf n_leaf_pages Number of leaf pages in the index |
| 118 |
vidxf size Number of pages in the index |
| 119 |
ALTER TABLE t DROP INDEX vidxcd; |
| 120 |
SELECT index_name, stat_name, stat_description |
| 121 |
FROM mysql.innodb_index_stats |
| 122 |
WHERE database_name = 'test' AND table_name = 't'; |
| 123 |
index_name stat_name stat_description |
| 124 |
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID |
| 125 |
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index |
| 126 |
GEN_CLUST_INDEX size Number of pages in the index |
| 127 |
idxb n_diff_pfx01 b |
| 128 |
idxb n_diff_pfx02 b,DB_ROW_ID |
| 129 |
idxb n_leaf_pages Number of leaf pages in the index |
| 130 |
idxb size Number of pages in the index |
| 131 |
vidxe n_diff_pfx01 e |
| 132 |
vidxe n_diff_pfx02 e,DB_ROW_ID |
| 133 |
vidxe n_leaf_pages Number of leaf pages in the index |
| 134 |
vidxe size Number of pages in the index |
| 135 |
vidxf n_diff_pfx01 f |
| 136 |
vidxf n_diff_pfx02 f,DB_ROW_ID |
| 137 |
vidxf n_leaf_pages Number of leaf pages in the index |
| 138 |
vidxf size Number of pages in the index |
| 139 |
DROP TABLE t; |