Type:
New Feature
Priority:
Critical
Resolution:
Unresolved
Sprint:
Q2/2025 Development
Filing this https://jira.mariadb.org/browse/MDEV-6181?focusedCommentId=57209&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-57209
as a separate issue:
Motivated by CSC#7897, I've tried to see how much space can ANALYZE use. (So far my understanding was that max. temp dir usage would be rougly equal to size of the table w/o indexes).
Let's try this:
create table ten(a int);
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table one_k(a int);
insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
create table t1 (pk int primary key, col1 varchar(100)) charset=utf8;
insert into t1 select A.a+B.a*1000, concat('val-', A.a+B.a*1000) from one_k A, one_k B;
The table has 1M rows. Rows in the VARCHAR(100) column occupy less than
300 bytes (which is typical).
The table on disk:
-rw-rw---- 1 psergey psergey 44M Aug 1 23:09 t1.ibd
Now,
analyze table t1 persistent for all;
Breakpoint 4, unique_write_to_file_with_count (key=0x7ffebf2ce0a0 "\005", count=1, unique=0x7ffebf047ef0) at /home/psergey/dev2/10.0/sql/uniques.cc:53
(gdb) print key
$7 = (uchar *) 0x7ffebf2ce0a0 "\005"
(gdb)
(gdb) p unique->size
$8 = 302
It's writing 300 bytes, the unpacked length.
In total, we get:
Breakpoint 3, Unique::flush (this=0x7ffebf047ef0) at /home/psergey/dev2/10.0/sql/uniques.cc:379
$46 = 281,734,200
Breakpoint 3, Unique::flush (this=0x7ffebf047ef0) at /home/psergey/dev2/10.0/sql/uniques.cc:379
$48 = 297,386,100
...
Breakpoint 3, Unique::flush (this=0x7ffebf047a30) at /home/psergey/dev2/10.0/sql/uniques.cc:379
$47 = 4,194,304
300MBit = 286 M, i.e. ANALYZE may require much more space than is occupied by the table (44M)
{"report":{"fcp":1008.6999998092651,"ttfb":202.10000038146973,"pageVisibility":"visible","entityId":42701,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"9cb8a819-0ac6-4004-ab56-79d8c9cd7346","navigationType":0,"readyForUser":1085.5,"redirectCount":0,"resourceLoadedEnd":1297,"resourceLoadedStart":207.69999980926514,"resourceTiming":[{"duration":325.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":207.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":207.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":533,"responseStart":0,"secureConnectionStart":0},{"duration":325.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":208,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":208,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":533.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":334.5999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":208.10000038146973,"connectEnd":208.10000038146973,"connectStart":208.10000038146973,"domainLookupEnd":208.10000038146973,"domainLookupStart":208.10000038146973,"fetchStart":208.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":208.10000038146973,"responseEnd":542.6999998092651,"responseStart":542.6000003814697,"secureConnectionStart":208.10000038146973},{"duration":370.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":208.30000019073486,"connectEnd":208.30000019073486,"connectStart":208.30000019073486,"domainLookupEnd":208.30000019073486,"domainLookupStart":208.30000019073486,"fetchStart":208.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":208.30000019073486,"responseEnd":579,"responseStart":579,"secureConnectionStart":208.30000019073486},{"duration":374.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":208.5,"connectEnd":208.5,"connectStart":208.5,"domainLookupEnd":208.5,"domainLookupStart":208.5,"fetchStart":208.5,"redirectEnd":0,"redirectStart":0,"requestStart":208.5,"responseEnd":583,"responseStart":583,"secureConnectionStart":208.5},{"duration":374.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":208.69999980926514,"connectEnd":208.69999980926514,"connectStart":208.69999980926514,"domainLookupEnd":208.69999980926514,"domainLookupStart":208.69999980926514,"fetchStart":208.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":208.69999980926514,"responseEnd":583.5,"responseStart":583.5,"secureConnectionStart":208.69999980926514},{"duration":375,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":208.9000005722046,"connectEnd":208.9000005722046,"connectStart":208.9000005722046,"domainLookupEnd":208.9000005722046,"domainLookupStart":208.9000005722046,"fetchStart":208.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":208.9000005722046,"responseEnd":583.9000005722046,"responseStart":583.9000005722046,"secureConnectionStart":208.9000005722046},{"duration":475.8999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":209.10000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":685,"responseStart":0,"secureConnectionStart":0},{"duration":374.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":209.30000019073486,"connectEnd":209.30000019073486,"connectStart":209.30000019073486,"domainLookupEnd":209.30000019073486,"domainLookupStart":209.30000019073486,"fetchStart":209.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":209.30000019073486,"responseEnd":584.1999998092651,"responseStart":584.1999998092651,"secureConnectionStart":209.30000019073486},{"duration":475.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":209.4000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":685.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":375.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":209.60000038146973,"connectEnd":209.60000038146973,"connectStart":209.60000038146973,"domainLookupEnd":209.60000038146973,"domainLookupStart":209.60000038146973,"fetchStart":209.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":209.60000038146973,"responseEnd":584.8000001907349,"responseStart":584.8000001907349,"secureConnectionStart":209.60000038146973},{"duration":903.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":210.80000019073486,"connectEnd":210.80000019073486,"connectStart":210.80000019073486,"domainLookupEnd":210.80000019073486,"domainLookupStart":210.80000019073486,"fetchStart":210.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":210.80000019073486,"responseEnd":1114.5,"responseStart":1114.5,"secureConnectionStart":210.80000019073486},{"duration":1081.5999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":215.4000005722046,"connectEnd":215.4000005722046,"connectStart":215.4000005722046,"domainLookupEnd":215.4000005722046,"domainLookupStart":215.4000005722046,"fetchStart":215.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":215.4000005722046,"responseEnd":1297,"responseStart":1297,"secureConnectionStart":215.4000005722046},{"duration":420.5999994277954,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":696.6000003814697,"connectEnd":696.6000003814697,"connectStart":696.6000003814697,"domainLookupEnd":696.6000003814697,"domainLookupStart":696.6000003814697,"fetchStart":696.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":696.6000003814697,"responseEnd":1117.1999998092651,"responseStart":1117.1999998092651,"secureConnectionStart":696.6000003814697},{"duration":311.30000019073486,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1002.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1002.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1314,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":30,"responseStart":202,"responseEnd":206,"domLoading":205,"domInteractive":1319,"domContentLoadedEventStart":1319,"domContentLoadedEventEnd":1360,"domComplete":1993,"loadEventStart":1993,"loadEventEnd":1994,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1302.6999998092651},{"name":"bigPipe.sidebar-id.end","time":1303.6000003814697},{"name":"bigPipe.activity-panel-pipe-id.start","time":1303.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1306.1999998092651},{"name":"activityTabFullyLoaded","time":1367.1999998092651}],"measures":[],"correlationId":"acbf8be94a6c31","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":106,"dbReadsTimeInMs":13,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}