Decided to upgrade older 10.3.13 with the currently latest version 10.5.6.
One of my sql selects started throwing SQL Error (1038): Out of sort memory.
Versions are running on the same machine (sharing the same port, so just one instance is running at a time). Did mysqldump to have identical conditions. Using default settings (attached system variables for both versions).
Need to set sort_buffer_size to ~120MB to make script working again while older one works well with default 2MB.
I managed to simlify the script while still keeping an error (I understand it does not makes sense now, its really a shortened version so I could share something with you):
DROP TABLE IF EXISTS test_products;
|
CREATE TABLE test_products (
|
product_name VARCHAR(7),
|
id_country INT,
|
PRIMARY KEY (product_name, id_country)
|
) COLLATE='utf8_general_ci' ENGINE=INNODB;
|
|
DELIMITER //
|
FOR i IN 1..3700 DO INSERT INTO test_products (product_name, id_country) VALUES ('product', i); END FOR; //
|
DELIMITER ;
|
|
SELECT p.product_name, p.id_country, hierarchy.hierarchy
|
FROM test_products p
|
LEFT JOIN (
|
SELECT p2.product_name, p2.id_country, h.hierarchy, MAX(test) AS test
|
FROM test_products p2
|
LEFT JOIN (
|
SELECT product_name, id_country, '_exactly_' AS hierarchy, 1 AS test -- removing one single character from string '_exactly_' will stop producing error
|
FROM test_products
|
) h ON h.product_name = p2.product_name AND h.id_country = p2.id_country
|
GROUP BY product_name, id_country, h.hierarchy
|
) hierarchy ON hierarchy.product_name = p.product_name AND hierarchy.id_country = p.id_country
|
Is this behaviour correct?
Is increasing sort_buffer_size a recommended way to make the script working again?
Thank you
{"report":{"fcp":1035.1999998092651,"ttfb":256.19999980926514,"pageVisibility":"visible","entityId":93038,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"caed7b71-80c3-4ee5-86d6-1f54f3ccc4eb","navigationType":0,"readyForUser":1197.7999997138977,"redirectCount":0,"resourceLoadedEnd":718.9000000953674,"resourceLoadedStart":267.7999997138977,"resourceTiming":[{"duration":10.800000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":267.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":267.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":278.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":11.400000095367432,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":268.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":268.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":279.5,"responseStart":0,"secureConnectionStart":0},{"duration":312.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":268.40000009536743,"connectEnd":281.2999997138977,"connectStart":281.2999997138977,"domainLookupEnd":281.2999997138977,"domainLookupStart":281.2999997138977,"fetchStart":268.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":281.5,"responseEnd":580.9000000953674,"responseStart":295.5,"secureConnectionStart":281.2999997138977},{"duration":450.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":268.5,"connectEnd":268.5,"connectStart":268.5,"domainLookupEnd":268.5,"domainLookupStart":268.5,"fetchStart":268.5,"redirectEnd":0,"redirectStart":0,"requestStart":285,"responseEnd":718.9000000953674,"responseStart":314.09999990463257,"secureConnectionStart":268.5},{"duration":49.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":268.7999997138977,"connectEnd":268.7999997138977,"connectStart":268.7999997138977,"domainLookupEnd":268.7999997138977,"domainLookupStart":268.7999997138977,"fetchStart":268.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":285.90000009536743,"responseEnd":318.2999997138977,"responseStart":310.59999990463257,"secureConnectionStart":268.7999997138977},{"duration":49.799999713897705,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":268.90000009536743,"connectEnd":268.90000009536743,"connectStart":268.90000009536743,"domainLookupEnd":268.90000009536743,"domainLookupStart":268.90000009536743,"fetchStart":268.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":286.19999980926514,"responseEnd":318.69999980926514,"responseStart":311.2999997138977,"secureConnectionStart":268.90000009536743},{"duration":51.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":269.09999990463257,"connectEnd":269.09999990463257,"connectStart":269.09999990463257,"domainLookupEnd":269.09999990463257,"domainLookupStart":269.09999990463257,"fetchStart":269.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":287.19999980926514,"responseEnd":320.40000009536743,"responseStart":312.2999997138977,"secureConnectionStart":269.09999990463257},{"duration":16.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":269.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":269.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":285.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":55.39999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":269.40000009536743,"connectEnd":269.40000009536743,"connectStart":269.40000009536743,"domainLookupEnd":269.40000009536743,"domainLookupStart":269.40000009536743,"fetchStart":269.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":289.2999997138977,"responseEnd":324.7999997138977,"responseStart":315.7999997138977,"secureConnectionStart":269.40000009536743},{"duration":18,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":269.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":269.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":287.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":56.10000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":269.7999997138977,"connectEnd":269.7999997138977,"connectStart":269.7999997138977,"domainLookupEnd":269.7999997138977,"domainLookupStart":269.7999997138977,"fetchStart":269.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":291.90000009536743,"responseEnd":325.90000009536743,"responseStart":322.40000009536743,"secureConnectionStart":269.7999997138977},{"duration":410.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":288.69999980926514,"connectEnd":288.69999980926514,"connectStart":288.69999980926514,"domainLookupEnd":288.69999980926514,"domainLookupStart":288.69999980926514,"fetchStart":288.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":308.5,"responseEnd":699.4000000953674,"responseStart":694.5,"secureConnectionStart":288.69999980926514},{"duration":411.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":288.7999997138977,"connectEnd":288.7999997138977,"connectStart":288.7999997138977,"domainLookupEnd":288.7999997138977,"domainLookupStart":288.7999997138977,"fetchStart":288.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":315.59999990463257,"responseEnd":700,"responseStart":695.6999998092651,"secureConnectionStart":288.7999997138977},{"duration":153.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":716.6999998092651,"connectEnd":716.6999998092651,"connectStart":716.6999998092651,"domainLookupEnd":716.6999998092651,"domainLookupStart":716.6999998092651,"fetchStart":716.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":834.5,"responseEnd":870,"responseStart":869.0999999046326,"secureConnectionStart":716.6999998092651},{"duration":243.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":963.1999998092651,"connectEnd":963.1999998092651,"connectStart":963.1999998092651,"domainLookupEnd":963.1999998092651,"domainLookupStart":963.1999998092651,"fetchStart":963.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1158.4000000953674,"responseEnd":1206.2999997138977,"responseStart":1205.0999999046326,"secureConnectionStart":963.1999998092651},{"duration":293,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1027.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1027.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1320.4000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":43,"domainLookupEnd":53,"connectStart":54,"connectEnd":77,"secureConnectionStart":63,"requestStart":78,"responseStart":256,"responseEnd":288,"domLoading":263,"domInteractive":1328,"domContentLoadedEventStart":1328,"domContentLoadedEventEnd":1386,"domComplete":1855,"loadEventStart":1855,"loadEventEnd":1855,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1300.5},{"name":"bigPipe.sidebar-id.end","time":1301.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1301.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1303.5999999046326},{"name":"activityTabFullyLoaded","time":1403.7999997138977}],"measures":[],"correlationId":"357d2fcec45a44","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":10,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The patch is present in the branch 10.5-varun