Type:
Bug
Priority:
Major
Resolution:
Unresolved
Affects Version/s:
10.6 , 10.11 , 11.4 , 11.6(EOL) , 11.7(EOL)
InnoDB persistent statistics behaves quite unexpectedly upon ALTER .. COPY (and differently non-copying ALTER).
Below is an original report demonstrating it via a vector key on 11.7. See comments for a generic test case without vectors, applicable to older versions
With vector key:
7fce19bd215ac0671855044520092aa4210049d1
MariaDB [test]> create or replace table t (pk int primary key , a int , v vector(1) not null , vector(v)) engine=InnoDB;
Query OK, 0 rows affected (0.110 sec)
MariaDB [test]> select table_name from mysql.innodb_table_stats where database_name = 'test' ;
+ ------------+
| table_name |
+ ------------+
| t |
| t#i#01 |
+ ------------+
2 rows in set (0.001 sec)
MariaDB [test]> select table_name, index_name, stat_name from mysql.innodb_index_stats where database_name = 'test' ;
+ ------------+-----------------+--------------+
| table_name | index_name | stat_name |
+ ------------+-----------------+--------------+
| t | PRIMARY | n_diff_pfx01 |
| t | PRIMARY | n_leaf_pages |
| t | PRIMARY | size |
| t#i#01 | GEN_CLUST_INDEX | n_diff_pfx01 |
| t#i#01 | GEN_CLUST_INDEX | n_leaf_pages |
| t#i#01 | GEN_CLUST_INDEX | size |
| t#i#01 | layer | n_diff_pfx01 |
| t#i#01 | layer | n_diff_pfx02 |
| t#i#01 | layer | n_leaf_pages |
| t#i#01 | layer | size |
| t#i#01 | tref | n_diff_pfx01 |
| t#i#01 | tref | n_leaf_pages |
| t#i#01 | tref | size |
+ ------------+-----------------+--------------+
13 rows in set (0.001 sec)
MariaDB [test]> alter table t add index (a);
Query OK, 0 rows affected (0.140 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [test]> select table_name from mysql.innodb_table_stats where database_name = 'test' ;
Empty set (0.001 sec)
MariaDB [test]> select table_name, index_name, stat_name from mysql.innodb_index_stats where database_name = 'test' ;
Empty set (0.001 sec)
I suppose it is expected that separate records are created for the index pseudo-table t#i#01 ; however, it is unclear why an innocent operation on the table (in this case an addition of another index, but also removal of any of the indexes) clears all table/index statistics.
It doesn't happen without vector key in otherwise identical circumstances; instead, statistical records for the new index are added, as would be reasonable to expect:
MariaDB [test]> create or replace table t (pk int primary key , a int , v vector(1) not null ) engine=InnoDB;
Query OK, 0 rows affected (0.080 sec)
MariaDB [test]> select table_name from mysql.innodb_table_stats where database_name = 'test' ;
+ ------------+
| table_name |
+ ------------+
| t |
+ ------------+
1 row in set (0.001 sec)
MariaDB [test]> select table_name, index_name, stat_name from mysql.innodb_index_stats where database_name = 'test' ;
+ ------------+------------+--------------+
| table_name | index_name | stat_name |
+ ------------+------------+--------------+
| t | PRIMARY | n_diff_pfx01 |
| t | PRIMARY | n_leaf_pages |
| t | PRIMARY | size |
+ ------------+------------+--------------+
3 rows in set (0.001 sec)
MariaDB [test]> alter table t add index (a);
Query OK, 0 rows affected (0.043 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [test]> select table_name from mysql.innodb_table_stats where database_name = 'test' ;
+ ------------+
| table_name |
+ ------------+
| t |
+ ------------+
1 row in set (0.001 sec)
MariaDB [test]> select table_name, index_name, stat_name from mysql.innodb_index_stats where database_name = 'test' ;
+ ------------+------------+--------------+
| table_name | index_name | stat_name |
+ ------------+------------+--------------+
| t | PRIMARY | n_diff_pfx01 |
| t | PRIMARY | n_leaf_pages |
| t | PRIMARY | size |
| t | a | n_diff_pfx01 |
| t | a | n_diff_pfx02 |
| t | a | n_leaf_pages |
| t | a | size |
+ ------------+------------+--------------+
7 rows in set (0.001 sec)
No workflow transitions have been executed yet.
{"report":{"fcp":1480.199999988079,"ttfb":657.0999999642372,"pageVisibility":"visible","entityId":131344,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"16d13066-39ed-4af8-b847-b838946e017c","navigationType":0,"readyForUser":1598.199999988079,"redirectCount":0,"resourceLoadedEnd":1834.3999999761581,"resourceLoadedStart":662.0999999642372,"resourceTiming":[{"duration":350.4000000357628,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":662.0999999642372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":662.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1012.5,"responseStart":0,"secureConnectionStart":0},{"duration":350.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":662.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":662.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1012.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":359.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":662.5,"connectEnd":662.5,"connectStart":662.5,"domainLookupEnd":662.5,"domainLookupStart":662.5,"fetchStart":662.5,"redirectEnd":0,"redirectStart":0,"requestStart":662.5,"responseEnd":1022,"responseStart":1022,"secureConnectionStart":662.5},{"duration":431.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":662.6999999880791,"connectEnd":662.6999999880791,"connectStart":662.6999999880791,"domainLookupEnd":662.6999999880791,"domainLookupStart":662.6999999880791,"fetchStart":662.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":662.6999999880791,"responseEnd":1093.8999999761581,"responseStart":1093.8999999761581,"secureConnectionStart":662.6999999880791},{"duration":434.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":662.8999999761581,"connectEnd":662.8999999761581,"connectStart":662.8999999761581,"domainLookupEnd":662.8999999761581,"domainLookupStart":662.8999999761581,"fetchStart":662.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":662.8999999761581,"responseEnd":1097.2999999523163,"responseStart":1097.2999999523163,"secureConnectionStart":662.8999999761581},{"duration":434.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":663.1999999880791,"connectEnd":663.1999999880791,"connectStart":663.1999999880791,"domainLookupEnd":663.1999999880791,"domainLookupStart":663.1999999880791,"fetchStart":663.1999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":663.1999999880791,"responseEnd":1097.699999988079,"responseStart":1097.699999988079,"secureConnectionStart":663.1999999880791},{"duration":434.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":663.3999999761581,"connectEnd":663.3999999761581,"connectStart":663.3999999761581,"domainLookupEnd":663.3999999761581,"domainLookupStart":663.3999999761581,"fetchStart":663.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":663.3999999761581,"responseEnd":1098,"responseStart":1098,"secureConnectionStart":663.3999999761581},{"duration":500.0999999642372,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":663.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":663.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1163.5999999642372,"responseStart":0,"secureConnectionStart":0},{"duration":434.80000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":663.6999999880791,"connectEnd":663.6999999880791,"connectStart":663.6999999880791,"domainLookupEnd":663.6999999880791,"domainLookupStart":663.6999999880791,"fetchStart":663.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":663.6999999880791,"responseEnd":1098.5,"responseStart":1098.5,"secureConnectionStart":663.6999999880791},{"duration":499.89999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":663.8999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":663.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1163.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":435,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":664,"connectEnd":664,"connectStart":664,"domainLookupEnd":664,"domainLookupStart":664,"fetchStart":664,"redirectEnd":0,"redirectStart":0,"requestStart":664,"responseEnd":1099,"responseStart":1099,"secureConnectionStart":664},{"duration":713.8000000119209,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":672.0999999642372,"connectEnd":672.0999999642372,"connectStart":672.0999999642372,"domainLookupEnd":672.0999999642372,"domainLookupStart":672.0999999642372,"fetchStart":672.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":672.0999999642372,"responseEnd":1385.8999999761581,"responseStart":1385.8999999761581,"secureConnectionStart":672.0999999642372},{"duration":1146.1000000238419,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":672.2999999523163,"connectEnd":672.2999999523163,"connectStart":672.2999999523163,"domainLookupEnd":672.2999999523163,"domainLookupStart":672.2999999523163,"fetchStart":672.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":672.2999999523163,"responseEnd":1818.3999999761581,"responseStart":1818.3999999761581,"secureConnectionStart":672.2999999523163},{"duration":212.10000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1174.2999999523163,"connectEnd":1174.2999999523163,"connectStart":1174.2999999523163,"domainLookupEnd":1174.2999999523163,"domainLookupStart":1174.2999999523163,"fetchStart":1174.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":1174.2999999523163,"responseEnd":1386.3999999761581,"responseStart":1386.3999999761581,"secureConnectionStart":1174.2999999523163},{"duration":394.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1434.699999988079,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1434.699999988079,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1829.199999988079,"responseStart":0,"secureConnectionStart":0},{"duration":393.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1435.5999999642372,"connectEnd":1435.5999999642372,"connectStart":1435.5999999642372,"domainLookupEnd":1435.5999999642372,"domainLookupStart":1435.5999999642372,"fetchStart":1435.5999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":1435.5999999642372,"responseEnd":1829.199999988079,"responseStart":1829.199999988079,"secureConnectionStart":1435.5999999642372},{"duration":446,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1474.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1474.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1920.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":398.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":1435.8999999761581,"connectEnd":1435.8999999761581,"connectStart":1435.8999999761581,"domainLookupEnd":1435.8999999761581,"domainLookupStart":1435.8999999761581,"fetchStart":1435.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":1435.8999999761581,"responseEnd":1834.3999999761581,"responseStart":1834.2999999523163,"secureConnectionStart":1435.8999999761581}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":468,"responseStart":657,"responseEnd":671,"domLoading":660,"domInteractive":1837,"domContentLoadedEventStart":1837,"domContentLoadedEventEnd":1881,"domComplete":2295,"loadEventStart":2295,"loadEventEnd":2295,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1820.199999988079},{"name":"bigPipe.sidebar-id.end","time":1821},{"name":"bigPipe.activity-panel-pipe-id.start","time":1821.0999999642372},{"name":"bigPipe.activity-panel-pipe-id.end","time":1821.5999999642372},{"name":"activityTabFullyLoaded","time":1924.5}],"measures":[],"correlationId":"4066ee3b5e0435","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":15,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}