-
Bug
-
-
Major
-
Resolution:
Unresolved
-
10.6
-
-
-
Put this in my.cnf:
slow-query-log
|
long-query-time=0.00001
|
log-slow-verbosity=full
|
Then run
create table t21(a int, b int);
|
insert into t21 select seq, seq from seq_1_to_10000;
|
select sum(a) from t21
|
union all
|
select sum(b) from t21;
|
Look into the slow query log. It shows something like:
# Time: 241106 16:05:31
|
# User@Host: root[root] @ localhost []
|
# Thread_id: 3 Schema: j1 QC_hit: No
|
# Query_time: 0.140179 Lock_time: 0.000414 Rows_sent: 2 Rows_examined: 0
|
# Rows_affected: 0 Bytes_sent: 81
|
# Pages_accessed: 48 Pages_read: 0 Pages_prefetched: 0 Pages_updated: 0 Old_rows_read: 0
|
# Pages_read_time: 0.0000 Engine_time: 123.8240
|
# Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
|
# Filesort: No Filesort_on_disk: No Merge_passes: 0 Priority_queue: No
|
#
|
# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
# explain: 1 PRIMARY t21 ALL NULL NULL NULL NULL 10157 10000.00 100.00 100.00
|
# explain: 2 UNION t21 ALL NULL NULL NULL NULL 10157 10000.00 100.00 100.00
|
#
|
SET timestamp=1730901931;
|
select sum(a) from t21
|
union all
|
select sum(b) from t21;
|
Note the Rows_examined: 0.
For comparison, if one uses UNION instead of UNION ALL:
select sum(a) from t21
|
union
|
select sum(b) from t21;
|
it shows Rows_examined: 20001 which is the real number:
# Time: 241106 16:04:59
|
# User@Host: root[root] @ localhost []
|
# Thread_id: 3 Schema: j1 QC_hit: No
|
# Query_time: 0.129300 Lock_time: 0.000127 Rows_sent: 1 Rows_examined: 20001
|
# Rows_affected: 0 Bytes_sent: 74
|
# Pages_accessed: 48 Pages_read: 0 Pages_prefetched: 0 Pages_updated: 0 Old_rows_read: 0
|
# Pages_read_time: 0.0000 Engine_time: 114.1540
|
# Tmp_tables: 1 Tmp_disk_tables: 0 Tmp_table_sizes: 126984
|
# Full_scan: Yes Full_join: No Tmp_table: Yes Tmp_table_on_disk: No
|
# Filesort: No Filesort_on_disk: No Merge_passes: 0 Priority_queue: No
|
#
|
# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
# explain: 1 PRIMARY t21 ALL NULL NULL NULL NULL 10000 10000.00 100.00 100.00
|
# explain: 2 UNION t21 ALL NULL NULL NULL NULL 10000 10000.00 100.00 100.00
|
# explain: NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 1.00 NULL NULL
|
#
|
SET timestamp=1730901899;
|
select sum(a) from t21
|
union
|
select sum(b) from t21;
|
There are no comments yet on this issue.
{"report":{"fcp":1218.5,"ttfb":400.30000019073486,"pageVisibility":"visible","entityId":131505,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ab855dd9-f488-40a4-90e8-01e2167db5ef","navigationType":0,"readyForUser":1314.4000000953674,"redirectCount":0,"resourceLoadedEnd":1032.9000000953674,"resourceLoadedStart":414.1000003814697,"resourceTiming":[{"duration":134.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":414.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":414.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":548.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":137.90000009536743,"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":414.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":414.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":552.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":305.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":414.6000003814697,"connectEnd":414.6000003814697,"connectStart":414.6000003814697,"domainLookupEnd":414.6000003814697,"domainLookupStart":414.6000003814697,"fetchStart":414.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":553.8000001907349,"responseEnd":720.3000001907349,"responseStart":565,"secureConnectionStart":414.6000003814697},{"duration":491.69999980926514,"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":414.80000019073486,"connectEnd":414.80000019073486,"connectStart":414.80000019073486,"domainLookupEnd":414.80000019073486,"domainLookupStart":414.80000019073486,"fetchStart":414.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":554.6000003814697,"responseEnd":906.5,"responseStart":573.6000003814697,"secureConnectionStart":414.80000019073486},{"duration":160.2000002861023,"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":414.90000009536743,"connectEnd":414.90000009536743,"connectStart":414.90000009536743,"domainLookupEnd":414.90000009536743,"domainLookupStart":414.90000009536743,"fetchStart":414.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":556,"responseEnd":575.1000003814697,"responseStart":572.8000001907349,"secureConnectionStart":414.90000009536743},{"duration":164.09999990463257,"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":415.1000003814697,"connectEnd":415.1000003814697,"connectStart":415.1000003814697,"domainLookupEnd":415.1000003814697,"domainLookupStart":415.1000003814697,"fetchStart":415.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":558.7000002861023,"responseEnd":579.2000002861023,"responseStart":576.8000001907349,"secureConnectionStart":415.1000003814697},{"duration":164.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":415.30000019073486,"connectEnd":415.30000019073486,"connectStart":415.30000019073486,"domainLookupEnd":415.30000019073486,"domainLookupStart":415.30000019073486,"fetchStart":415.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":558.9000000953674,"responseEnd":579.8000001907349,"responseStart":577.8000001907349,"secureConnectionStart":415.30000019073486},{"duration":143.2000002861023,"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":415.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":415.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":558.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":190.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":415.7000002861023,"connectEnd":415.7000002861023,"connectStart":415.7000002861023,"domainLookupEnd":415.7000002861023,"domainLookupStart":415.7000002861023,"fetchStart":415.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":562.3000001907349,"responseEnd":606,"responseStart":604.2000002861023,"secureConnectionStart":415.7000002861023},{"duration":145.30000019073486,"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":415.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":415.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":561.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":174.90000009536743,"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":416,"connectEnd":416,"connectStart":416,"domainLookupEnd":416,"domainLookupStart":416,"fetchStart":416,"redirectEnd":0,"redirectStart":0,"requestStart":568.3000001907349,"responseEnd":590.9000000953674,"responseStart":583.5,"secureConnectionStart":416},{"duration":453.80000019073486,"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":461.30000019073486,"connectEnd":461.30000019073486,"connectStart":461.30000019073486,"domainLookupEnd":461.30000019073486,"domainLookupStart":461.30000019073486,"fetchStart":461.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":869.7000002861023,"responseEnd":915.1000003814697,"responseStart":914.2000002861023,"secureConnectionStart":461.30000019073486},{"duration":571.5,"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":461.40000009536743,"connectEnd":461.40000009536743,"connectStart":461.40000009536743,"domainLookupEnd":461.40000009536743,"domainLookupStart":461.40000009536743,"fetchStart":461.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":1021.9000000953674,"responseEnd":1032.9000000953674,"responseStart":1031.9000000953674,"secureConnectionStart":461.40000009536743},{"duration":201,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":851,"connectEnd":851,"connectStart":851,"domainLookupEnd":851,"domainLookupStart":851,"fetchStart":851,"redirectEnd":0,"redirectStart":0,"requestStart":1018.9000000953674,"responseEnd":1052,"responseStart":1051.3000001907349,"secureConnectionStart":851},{"duration":335,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1152.3000001907349,"connectEnd":1152.3000001907349,"connectStart":1152.3000001907349,"domainLookupEnd":1152.3000001907349,"domainLookupStart":1152.3000001907349,"fetchStart":1152.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1447.8000001907349,"responseEnd":1487.3000001907349,"responseStart":1484.3000001907349,"secureConnectionStart":1152.3000001907349}],"fetchStart":0,"domainLookupStart":200,"domainLookupEnd":208,"connectStart":208,"connectEnd":229,"secureConnectionStart":217,"requestStart":229,"responseStart":400,"responseEnd":418,"domLoading":412,"domInteractive":1434,"domContentLoadedEventStart":1435,"domContentLoadedEventEnd":1495,"domComplete":2182,"loadEventStart":2182,"loadEventEnd":2183,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1406.8000001907349},{"name":"bigPipe.sidebar-id.end","time":1407.7000002861023},{"name":"bigPipe.activity-panel-pipe-id.start","time":1407.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1408.4000000953674},{"name":"activityTabFullyLoaded","time":1502.3000001907349}],"measures":[],"correlationId":"c626f48ef81447","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":90,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}