This test case is not working on MariaDB 10.1.3:
CREATE TABLE
test ( id INT , type_id INT , PRIMARY KEY (id) );
INSERT INTO
test ( id, type_id )
VALUES
( 1, 1 ),
( 2, 1 ),
( 3, 2 ),
( 4, 5 );
SELECT
*
FROM
test T
JOIN (
(
SELECT 1 AS some_another_type_id
)
UNION ALL
(
SELECT 2 AS some_another_type_id
)
ORDER BY
some_another_type_id DESC
) AAA
WHERE
T.type_id = 1;
Same query on clean Mysql 5.6 working with no problems.
Workaround: delete unneeded "order by".
m.rygiel
created issue -
2015-03-17 12:54
Elena Stepanova
made changes -
2015-03-17 17:32
Field
Original Value
New Value
Description
*This test case is not working on MariaDB 10.1.3:*
CREATE TABLE
test ( id INT, type_id INT, PRIMARY KEY(id) );
INSERT INTO
test ( id, type_id )
VALUES
( 1, 1 ),
( 2, 1 ),
( 3, 2 ),
( 4, 5 );
SELECT
*
FROM
test T
JOIN (
(
SELECT 1 AS some_another_type_id
)
UNION ALL
(
SELECT 2 AS some_another_type_id
)
ORDER BY
some_another_type_id DESC
) AAA
WHERE
T.type_id = 1
Same query on clean Mysql 5.6 working with no problems.
Workaround: delete unneeded "order by".
*This test case is not working on MariaDB 10.1.3:*
{code:sql}
CREATE TABLE
test ( id INT, type_id INT, PRIMARY KEY(id) );
INSERT INTO
test ( id, type_id )
VALUES
( 1, 1 ),
( 2, 1 ),
( 3, 2 ),
( 4, 5 );
SELECT
*
FROM
test T
JOIN (
(
SELECT 1 AS some_another_type_id
)
UNION ALL
(
SELECT 2 AS some_another_type_id
)
ORDER BY
some_another_type_id DESC
) AAA
WHERE
T.type_id = 1;
{code}
Same query on clean Mysql 5.6 working with no problems.
Workaround: delete unneeded "order by".
Elena Stepanova
made changes -
2015-03-17 18:12
Fix Version/s
10.1
[ 16100
]
Assignee
Igor Babaev
[ igor
]
Labels
verified
Sergei Golubchik
made changes -
2015-06-17 17:19
Status
Open
[ 1
]
Confirmed
[ 10101
]
Sergey Vojtovich
made changes -
2015-06-17 17:28
Assignee
Sergey Vojtovich
[ svoj
]
Sergey Vojtovich
made changes -
2015-06-24 14:15
Assignee
Sergey Vojtovich
[ svoj
]
Sergei Golubchik
[ serg
]
Status
Confirmed
[ 10101
]
In Review
[ 10002
]
Sergei Golubchik
made changes -
2015-06-24 22:01
Assignee
Sergei Golubchik
[ serg
]
Oleksandr Byelkin
[ sanja
]
Oleksandr Byelkin
made changes -
2015-06-25 15:45
Status
In Review
[ 10002
]
Stalled
[ 10000
]
Sergey Vojtovich
made changes -
2015-06-29 11:16
Assignee
Oleksandr Byelkin
[ sanja
]
Sergey Vojtovich
[ svoj
]
Sergey Vojtovich
made changes -
2015-06-29 11:17
Remote Link
This issue links to "Github revision (Web Link)"
[ 23900
]
Sergey Vojtovich
made changes -
2015-06-29 11:17
Fix Version/s
10.1.6
[ 19401
]
Fix Version/s
10.1
[ 16100
]
Resolution
Fixed
[ 1
]
Status
Stalled
[ 10000
]
Closed
[ 6
]
Sergei Golubchik
made changes -
2021-12-06 21:41
Workflow
MariaDB v3
[ 66160
]
MariaDB v4
[ 148905
]
{"report":{"fcp":5710.799999952316,"ttfb":1504.5,"pageVisibility":"visible","entityId":50526,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0,"journeyId":"3a82739b-e7f8-4fa0-becd-a73eb8e120d8","navigationType":0,"readyForUser":5822,"redirectCount":0,"resourceLoadedEnd":4967.599999904633,"resourceLoadedStart":1635.5999999046326,"resourceTiming":[{"duration":1546.6000001430511,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":1635.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1635.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":3182.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":1546.7999999523163,"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":1635.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1635.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":3182.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":2850.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":1636.2999999523163,"connectEnd":1636.2999999523163,"connectStart":1636.2999999523163,"domainLookupEnd":1636.2999999523163,"domainLookupStart":1636.2999999523163,"fetchStart":1636.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":3184.9000000953674,"responseEnd":4487.200000047684,"responseStart":3594.7000000476837,"secureConnectionStart":1636.2999999523163},{"duration":3331.0999999046326,"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":1636.5,"connectEnd":1636.5,"connectStart":1636.5,"domainLookupEnd":1636.5,"domainLookupStart":1636.5,"fetchStart":1636.5,"redirectEnd":0,"redirectStart":0,"requestStart":3185.0999999046326,"responseEnd":4967.599999904633,"responseStart":3602.5,"secureConnectionStart":1636.5},{"duration":2405.7000000476837,"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":1637.0999999046326,"connectEnd":1637.0999999046326,"connectStart":1637.0999999046326,"domainLookupEnd":1637.0999999046326,"domainLookupStart":1637.0999999046326,"fetchStart":1637.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":3185.2000000476837,"responseEnd":4042.7999999523163,"responseStart":4035.5999999046326,"secureConnectionStart":1637.0999999046326},{"duration":2398.2000000476837,"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":1637.2999999523163,"connectEnd":1637.2999999523163,"connectStart":1637.2999999523163,"domainLookupEnd":1637.2999999523163,"domainLookupStart":1637.2999999523163,"fetchStart":1637.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":3185.2999999523163,"responseEnd":4035.5,"responseStart":3739.0999999046326,"secureConnectionStart":1637.2999999523163},{"duration":2405.5,"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":1637.5,"connectEnd":1637.5,"connectStart":1637.5,"domainLookupEnd":1637.5,"domainLookupStart":1637.5,"fetchStart":1637.5,"redirectEnd":0,"redirectStart":0,"requestStart":3185.2999999523163,"responseEnd":4043,"responseStart":4038.7000000476837,"secureConnectionStart":1637.5},{"duration":1546,"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":1637.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1637.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":3183.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":2405.699999809265,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":1640.4000000953674,"connectEnd":1640.4000000953674,"connectStart":1640.4000000953674,"domainLookupEnd":1640.4000000953674,"domainLookupStart":1640.4000000953674,"fetchStart":1640.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":3227.4000000953674,"responseEnd":4046.0999999046326,"responseStart":4043.2000000476837,"secureConnectionStart":1640.4000000953674},{"duration":1543.2000000476837,"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":1640.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1640.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":3183.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":2640.9000000953674,"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":1640.7999999523163,"connectEnd":1640.7999999523163,"connectStart":1640.7999999523163,"domainLookupEnd":1640.7999999523163,"domainLookupStart":1640.7999999523163,"fetchStart":1640.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":3228,"responseEnd":4281.700000047684,"responseStart":4043.5999999046326,"secureConnectionStart":1640.7999999523163},{"duration":3244.600000143051,"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":1641.7999999523163,"connectEnd":1641.7999999523163,"connectStart":1641.7999999523163,"domainLookupEnd":1641.7999999523163,"domainLookupStart":1641.7999999523163,"fetchStart":1641.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":3543,"responseEnd":4886.400000095367,"responseStart":4796,"secureConnectionStart":1641.7999999523163},{"duration":3322.7999999523163,"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":1641.9000000953674,"connectEnd":1641.9000000953674,"connectStart":1641.9000000953674,"domainLookupEnd":1641.9000000953674,"domainLookupStart":1641.9000000953674,"fetchStart":1641.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":3713.5999999046326,"responseEnd":4964.700000047684,"responseStart":4962,"secureConnectionStart":1641.9000000953674},{"duration":568.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":4647.599999904633,"connectEnd":4647.599999904633,"connectStart":4647.599999904633,"domainLookupEnd":4647.599999904633,"domainLookupStart":4647.599999904633,"fetchStart":4647.599999904633,"redirectEnd":0,"redirectStart":0,"requestStart":5120.5,"responseEnd":5216.099999904633,"responseStart":5152.700000047684,"secureConnectionStart":4647.599999904633}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":920,"responseStart":1505,"responseEnd":1581,"domLoading":1579,"domInteractive":5886,"domContentLoadedEventStart":5886,"domContentLoadedEventEnd":5955,"domComplete":7884,"loadEventStart":7884,"loadEventEnd":7885,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":5838.700000047684},{"name":"bigPipe.sidebar-id.end","time":5839.599999904633},{"name":"bigPipe.activity-panel-pipe-id.start","time":5839.799999952316},{"name":"bigPipe.activity-panel-pipe-id.end","time":5844.799999952316},{"name":"activityTabFullyLoaded","time":5977.799999952316}],"measures":[],"correlationId":"6ac037a7999c41","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":148,"dbReadsTimeInMs":25,"dbConnsTimeInMs":35,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thanks for the report and the test case.
The problem appeared along with UNION ALL optimization:
commit 3c4bb0e8720b84a14fe4822d1986d01290b9ab44 fec5ab5a56cb9a45c621207620cc85079cddf537
Author: Igor Babaev <igor@askmonty.org>
Date: Tue Oct 14 09:36:50 2014 -0700
MDEV-334: Backport of UNION ALL optimization from mysql-5.7.
Although the original code of mysql-5.7 was adjusted
to the current MariaDB code the main ideas of the optimization
were preserved.
The same test case works all right on the current 5.7 tree.