Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.5.6
-
Windows Server 2012R2 verson 6.3; Xeon E3-1225@3.2Ghz; 16GB ram
Description
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
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Attachment | settings-10.5.6 [ 54477 ] | |
Attachment | settings-10.3.13 [ 54478 ] |
Affects Version/s | 10.5.6 [ 24508 ] |
Priority | Minor [ 4 ] | Major [ 3 ] |
Assignee | Varun Gupta [ varun ] |
Fix Version/s | 10.5 [ 23123 ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Summary | SQL Error (1038): Out of sort memory on 10.5.6 while the same script is working on 10.3.13 | SQL Error (1038): Out of sort memory on 10.5.6 when enough memory for the sort buffer is provided |
Summary | SQL Error (1038): Out of sort memory on 10.5.6 when enough memory for the sort buffer is provided | SQL Error (1038): Out of sort memory when enough memory for the sort buffer is provided |
Priority | Critical [ 2 ] | Blocker [ 1 ] |
Assignee | Varun Gupta [ varun ] | Sergei Petrunia [ psergey ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Sergei Petrunia [ psergey ] | Varun Gupta [ varun ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.5.7 [ 25019 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 114879 ] | MariaDB v4 [ 158497 ] |