This script:
DROP TABLE IF EXISTS t1,t2,t3;
|
CREATE TABLE t1 (a INT);
|
CREATE TABLE t2 (a INT);
|
CREATE TABLE t3 (a INT);
|
INSERT INTO t1 VALUES (1),(2),(3);
|
INSERT INTO t2 VALUES (1),(2),(3);
|
INSERT INTO t3 VALUES (1),(2),(3);
|
EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) (t2 NATURAL JOIN t3));
|
returns
+------+-------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
|
| 1 | PRIMARY | t2 | ALL | NULL | NULL | NULL | NULL | 3 | |
|
| 1 | PRIMARY | t3 | ALL | NULL | NULL | NULL | NULL | 3 | Using where; Using join buffer (flat, BNL join) |
|
| 2 | SUBQUERY | t1 | ALL | NULL | NULL | NULL | NULL | 3 | |
|
+------+-------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
|
This looks wrong. The table "t1" does not affect the result and should probably be optimized away.
- relates to
-
MDEV-10057
Crash with EXPLAIN + WITH + constant query
-
-
Closed
{"report":{"fcp":1062.1000000238419,"ttfb":295.89999997615814,"pageVisibility":"visible","entityId":56713,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ed5e2a0f-c53d-43b1-8b3e-52e296fc4876","navigationType":0,"readyForUser":1164,"redirectCount":0,"resourceLoadedEnd":1310.5,"resourceLoadedStart":302.3000000715256,"resourceTiming":[{"duration":203.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":302.3000000715256,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":302.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":505.39999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":206.29999995231628,"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":302.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":302.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":508.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":265.1999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":302.7000000476837,"connectEnd":302.7000000476837,"connectStart":302.7000000476837,"domainLookupEnd":302.7000000476837,"domainLookupStart":302.7000000476837,"fetchStart":302.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":302.7000000476837,"responseEnd":567.8999999761581,"responseStart":567.8999999761581,"secureConnectionStart":302.7000000476837},{"duration":376.2000000476837,"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":302.89999997615814,"connectEnd":302.89999997615814,"connectStart":302.89999997615814,"domainLookupEnd":302.89999997615814,"domainLookupStart":302.89999997615814,"fetchStart":302.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":302.89999997615814,"responseEnd":679.1000000238419,"responseStart":679.1000000238419,"secureConnectionStart":302.89999997615814},{"duration":379.7999999523163,"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":303.10000002384186,"connectEnd":303.10000002384186,"connectStart":303.10000002384186,"domainLookupEnd":303.10000002384186,"domainLookupStart":303.10000002384186,"fetchStart":303.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":303.10000002384186,"responseEnd":682.8999999761581,"responseStart":682.8999999761581,"secureConnectionStart":303.10000002384186},{"duration":380.09999990463257,"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":303.3000000715256,"connectEnd":303.3000000715256,"connectStart":303.3000000715256,"domainLookupEnd":303.3000000715256,"domainLookupStart":303.3000000715256,"fetchStart":303.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":303.3000000715256,"responseEnd":683.3999999761581,"responseStart":683.3999999761581,"secureConnectionStart":303.3000000715256},{"duration":380.40000009536743,"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":303.39999997615814,"connectEnd":303.39999997615814,"connectStart":303.39999997615814,"domainLookupEnd":303.39999997615814,"domainLookupStart":303.39999997615814,"fetchStart":303.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":303.39999997615814,"responseEnd":683.8000000715256,"responseStart":683.8000000715256,"secureConnectionStart":303.39999997615814},{"duration":408.7999999523163,"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":303.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":303.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":712.3999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":380.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":303.8000000715256,"connectEnd":303.8000000715256,"connectStart":303.8000000715256,"domainLookupEnd":303.8000000715256,"domainLookupStart":303.8000000715256,"fetchStart":303.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":303.8000000715256,"responseEnd":684.3000000715256,"responseStart":684.3000000715256,"secureConnectionStart":303.8000000715256},{"duration":408.7000000476837,"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":303.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":303.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":712.6000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":380.89999997615814,"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":304.10000002384186,"connectEnd":304.10000002384186,"connectStart":304.10000002384186,"domainLookupEnd":304.10000002384186,"domainLookupStart":304.10000002384186,"fetchStart":304.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":304.10000002384186,"responseEnd":685,"responseStart":685,"secureConnectionStart":304.10000002384186},{"duration":605,"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":304.89999997615814,"connectEnd":304.89999997615814,"connectStart":304.89999997615814,"domainLookupEnd":304.89999997615814,"domainLookupStart":304.89999997615814,"fetchStart":304.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":304.89999997615814,"responseEnd":909.8999999761581,"responseStart":909.8999999761581,"secureConnectionStart":304.89999997615814},{"duration":1004.7000000476837,"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":305,"connectEnd":305,"connectStart":305,"domainLookupEnd":305,"domainLookupStart":305,"fetchStart":305,"redirectEnd":0,"redirectStart":0,"requestStart":305,"responseEnd":1309.7000000476837,"responseStart":1309.7000000476837,"secureConnectionStart":305},{"duration":198.79999995231628,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":725.3000000715256,"connectEnd":725.3000000715256,"connectStart":725.3000000715256,"domainLookupEnd":725.3000000715256,"domainLookupStart":725.3000000715256,"fetchStart":725.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":725.3000000715256,"responseEnd":924.1000000238419,"responseStart":924.1000000238419,"secureConnectionStart":725.3000000715256},{"duration":301,"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":1009.5,"connectEnd":1009.5,"connectStart":1009.5,"domainLookupEnd":1009.5,"domainLookupStart":1009.5,"fetchStart":1009.5,"redirectEnd":0,"redirectStart":0,"requestStart":1009.5,"responseEnd":1310.5,"responseStart":1310.5,"secureConnectionStart":1009.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":130,"responseStart":296,"responseEnd":297,"domLoading":300,"domInteractive":1382,"domContentLoadedEventStart":1382,"domContentLoadedEventEnd":1441,"domComplete":1949,"loadEventStart":1949,"loadEventEnd":1950,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1354},{"name":"bigPipe.sidebar-id.end","time":1354.8999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":1355},{"name":"bigPipe.activity-panel-pipe-id.end","time":1357},{"name":"activityTabFullyLoaded","time":1461}],"measures":[],"correlationId":"d18725fbf625eb","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":105,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
By the way, this syntax is not standard:
<with clause> cannot be followed by a <parenthesized joined table>.
It can be followed by <query expression> only.
The correct standard syntax is:
And EXPLAIN for this standard query crashes. See
MDEV-10057.