Looking at the data, one sees that only the original Q1 benefits from the patch. For other queries, the difference between medians is too small when compared to stddev. Value distribution charts (see attached file) also do not show a difference.
Sergei Petrunia
added a comment - Looking at the data, one sees that only the original Q1 benefits from the patch. For other queries, the difference between medians is too small when compared to stddev. Value distribution charts (see attached file) also do not show a difference.
The reason for this is: field_conv() is only executed by the query that uses a GROUP BY.
Queries without group by do not run field_conv(), and so do not benefit from the patch.
Stacktrace of where we hit field_conv:
Breakpoint 1, field_conv (to=0xd49d618, from=0xd4978a8) at /home/psergey/dev2/5.5/sql/field_conv.cc:829
(gdb) wher
#0 field_conv (to=0xd49d618, from=0xd4978a8) at /home/psergey/dev2/5.5/sql/field_conv.cc:829
#1 0x0840c94b in save_field_in_field (from=0xd4978a8, null_value=0xd48acfb, to=0xd49d618, no_conversions=true) at /home/psergey/dev2/5.5/sql/item.cc:5795
#2 0x0840cc3a in Item_field::save_org_in_field (this=0xd48acb8, to=0xd49d618) at /home/psergey/dev2/5.5/sql/item.cc:5807
#3 0x08272910 in end_update (join=0xd48e240, join_tab=0xd48f4a0, end_of_records=false) at /home/psergey/dev2/5.5/sql/sql_select.cc:17618
#4 0x08270aef in evaluate_join_record (join=0xd48e240, join_tab=0xd48f298, error=0) at /home/psergey/dev2/5.5/sql/sql_select.cc:16496
#5 0x0827dde9 in sub_select (join=0xd48e240, join_tab=0xd48f298, end_of_records=false) at /home/psergey/dev2/5.5/sql/sql_select.cc:16277
#6 0x08281149 in do_select (join=0xd48e240, fields=0x0, table=0xd49bb18, procedure=0x0) at /home/psergey/dev2/5.5/sql/sql_select.cc:15947
#7 0x082985bd in JOIN::exec (this=0xd48e240) at /home/psergey/dev2/5.5/sql/sql_select.cc:2405
#8 0x08294034 in mysql_select (thd=0xd47f108, rref_pointer_array=0xd480d34, tables=0xd48d808, wild_num=0, fields=..., conds=0xd48dd28, og_num=4, order=0xd48e0a0, group=0xd48ded0, having=0x0, proc_param=0x0, select_options=2147748608, result=0xd48e230, unit=0xd480744, select_lex=0xd480bf4) at /home/psergey/dev2/5.5/sql/sql_select.cc:3062
Sergei Petrunia
added a comment - The reason for this is: field_conv() is only executed by the query that uses a GROUP BY.
Queries without group by do not run field_conv(), and so do not benefit from the patch.
Stacktrace of where we hit field_conv:
Breakpoint 1, field_conv (to=0xd49d618, from=0xd4978a8) at /home/psergey/dev2/5.5/sql/field_conv.cc:829
(gdb) wher
#0 field_conv (to=0xd49d618, from=0xd4978a8) at /home/psergey/dev2/5.5/sql/field_conv.cc:829
#1 0x0840c94b in save_field_in_field (from=0xd4978a8, null_value=0xd48acfb, to=0xd49d618, no_conversions=true) at /home/psergey/dev2/5.5/sql/item.cc:5795
#2 0x0840cc3a in Item_field::save_org_in_field (this=0xd48acb8, to=0xd49d618) at /home/psergey/dev2/5.5/sql/item.cc:5807
#3 0x08272910 in end_update (join=0xd48e240, join_tab=0xd48f4a0, end_of_records=false) at /home/psergey/dev2/5.5/sql/sql_select.cc:17618
#4 0x08270aef in evaluate_join_record (join=0xd48e240, join_tab=0xd48f298, error=0) at /home/psergey/dev2/5.5/sql/sql_select.cc:16496
#5 0x0827dde9 in sub_select (join=0xd48e240, join_tab=0xd48f298, end_of_records=false) at /home/psergey/dev2/5.5/sql/sql_select.cc:16277
#6 0x08281149 in do_select (join=0xd48e240, fields=0x0, table=0xd49bb18, procedure=0x0) at /home/psergey/dev2/5.5/sql/sql_select.cc:15947
#7 0x082985bd in JOIN::exec (this=0xd48e240) at /home/psergey/dev2/5.5/sql/sql_select.cc:2405
#8 0x08294034 in mysql_select (thd=0xd47f108, rref_pointer_array=0xd480d34, tables=0xd48d808, wild_num=0, fields=..., conds=0xd48dd28, og_num=4, order=0xd48e0a0, group=0xd48ded0, having=0x0, proc_param=0x0, select_options=2147748608, result=0xd48e230, unit=0xd480744, select_lex=0xd480bf4) at /home/psergey/dev2/5.5/sql/sql_select.cc:3062
There are two calls to field_conv() made for each row, because GROUP BY list has two elements:
group by l_returnflag, l_linestatus
The fields have the same types (both are CHAR(1) nullable), hence field_conv() calls proceed on the same route.
Before the patch,
field_conv() made the following virtual function calls:
Breakpoint 4, field_conv (to=0xd49d610, from=0xd4978a0) at /home/psergey/dev2/5.5/sql/field_conv.cc:829
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1620
Field::pack_length (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:286
Field::pack_length (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:286
Field_str::decimals (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:735
Field_str::decimals (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:735
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_str::charset (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:745
Field_str::charset (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:745
Field_string::real_type (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:1662
14 calls
After the patch:
Field_string::real_type (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::type (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:1620
Field::pack_length (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:286
Field::pack_length (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:286
Field_str::decimals (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:735
Field_str::decimals (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:735
Field_str::charset (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:745
Field_str::charset (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:745
9 calls
We've managed to remove 5 out of 14 calls. There is a potential to remove another 9 calls, if we switch field_conv() from dynamic decision-making to static one.
Sergei Petrunia
added a comment - There are two calls to field_conv() made for each row, because GROUP BY list has two elements:
group by l_returnflag, l_linestatus
The fields have the same types (both are CHAR(1) nullable), hence field_conv() calls proceed on the same route.
Before the patch,
field_conv() made the following virtual function calls:
Breakpoint 4, field_conv (to=0xd49d610, from=0xd4978a0) at /home/psergey/dev2/5.5/sql/field_conv.cc:829
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1620
Field::pack_length (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:286
Field::pack_length (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:286
Field_str::decimals (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:735
Field_str::decimals (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:735
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_str::charset (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:745
Field_str::charset (this=0xd49d610) at /home/psergey/dev2/5.5/sql/field.h:745
Field_string::real_type (this=0xd4978a0) at /home/psergey/dev2/5.5/sql/field.h:1662
14 calls
After the patch:
Field_string::real_type (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::real_type (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:1662
Field_string::type (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:1620
Field::pack_length (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:286
Field::pack_length (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:286
Field_str::decimals (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:735
Field_str::decimals (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:735
Field_str::charset (this=0xd4978a8) at /home/psergey/dev2/5.5/sql/field.h:745
Field_str::charset (this=0xd49d618) at /home/psergey/dev2/5.5/sql/field.h:745
9 calls
We've managed to remove 5 out of 14 calls. There is a potential to remove another 9 calls, if we switch field_conv() from dynamic decision-making to static one.
Data from my 'pylon' machine. DBT3 sf=1, compile-pentium-max, Q1 as defined by Q1_virtfun_patch2-edited.ods. The patch is 201402181003_sanja_copy_calls_patch.diff.
That is, there is speedup on 5.5 but not on 10.0, for some reason.
Sergei Petrunia
added a comment - Data from my 'pylon' machine. DBT3 sf=1, compile-pentium-max, Q1 as defined by Q1_virtfun_patch2-edited.ods. The patch is 201402181003_sanja_copy_calls_patch.diff.
mariadb-5.5 vanilla - 4.81 sec (+/-0.02 sec)
mariadb-5.5 + patch - 4.58 sec (+/- 0.02 sec) – The patch gives ~ 5% speedup.
mariadb-10.0 vanilla - 5.30 (+/0 0.01 sec)
mariadb-10.0 + patch - 5.28 (+/- 0.02 sec) – The patch 0.4% speedup, a barely noticeable difference.
That is, there is speedup on 5.5 but not on 10.0, for some reason.
People
Oleksandr Byelkin
Sergei Petrunia
Votes:
0Vote for this issue
Watchers:
5Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1019.7000000476837,"ttfb":270.10000002384186,"pageVisibility":"visible","entityId":23422,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"9104142f-02d8-4dd4-947f-506f6f7657db","navigationType":0,"readyForUser":1091.6000000238419,"redirectCount":0,"resourceLoadedEnd":654,"resourceLoadedStart":277.10000002384186,"resourceTiming":[{"duration":25.200000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":277.10000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":277.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":302.3000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":21.100000023841858,"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":281.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":302.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":227.69999992847443,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":281.8000000715256,"connectEnd":304.60000002384186,"connectStart":304.60000002384186,"domainLookupEnd":304.60000002384186,"domainLookupStart":304.60000002384186,"fetchStart":281.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":305.60000002384186,"responseEnd":509.5,"responseStart":324.60000002384186,"secureConnectionStart":304.60000002384186},{"duration":357.8000000715256,"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":282.5,"connectEnd":282.5,"connectStart":282.5,"domainLookupEnd":282.5,"domainLookupStart":282.5,"fetchStart":282.5,"redirectEnd":0,"redirectStart":0,"requestStart":306,"responseEnd":640.3000000715256,"responseStart":332.2000000476837,"secureConnectionStart":282.5},{"duration":41.5,"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":282.7000000476837,"connectEnd":282.7000000476837,"connectStart":282.7000000476837,"domainLookupEnd":282.7000000476837,"domainLookupStart":282.7000000476837,"fetchStart":282.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":306.10000002384186,"responseEnd":324.2000000476837,"responseStart":321.2000000476837,"secureConnectionStart":282.7000000476837},{"duration":51.5,"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":283,"connectEnd":283,"connectStart":283,"domainLookupEnd":283,"domainLookupStart":283,"fetchStart":283,"redirectEnd":0,"redirectStart":0,"requestStart":307.89999997615814,"responseEnd":334.5,"responseStart":331.10000002384186,"secureConnectionStart":283},{"duration":54.89999997615814,"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":283.10000002384186,"connectEnd":283.10000002384186,"connectStart":283.10000002384186,"domainLookupEnd":283.10000002384186,"domainLookupStart":283.10000002384186,"fetchStart":283.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":309.39999997615814,"responseEnd":338,"responseStart":335.2000000476837,"secureConnectionStart":283.10000002384186},{"duration":24.399999976158142,"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":283.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":283.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":307.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":54.700000047683716,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":283.39999997615814,"connectEnd":283.39999997615814,"connectStart":283.39999997615814,"domainLookupEnd":283.39999997615814,"domainLookupStart":283.39999997615814,"fetchStart":283.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":312.5,"responseEnd":338.10000002384186,"responseStart":335.8000000715256,"secureConnectionStart":283.39999997615814},{"duration":27,"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":283.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":283.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":310.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":58.799999952316284,"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":283.7000000476837,"connectEnd":283.7000000476837,"connectStart":283.7000000476837,"domainLookupEnd":283.7000000476837,"domainLookupStart":283.7000000476837,"fetchStart":283.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":312.7000000476837,"responseEnd":342.5,"responseStart":336.60000002384186,"secureConnectionStart":283.7000000476837},{"duration":365.60000002384186,"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":287.39999997615814,"connectEnd":287.39999997615814,"connectStart":287.39999997615814,"domainLookupEnd":287.39999997615814,"domainLookupStart":287.39999997615814,"fetchStart":287.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":357.5,"responseEnd":653,"responseStart":642.3999999761581,"secureConnectionStart":287.39999997615814},{"duration":366.60000002384186,"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":287.39999997615814,"connectEnd":287.39999997615814,"connectStart":287.39999997615814,"domainLookupEnd":287.39999997615814,"domainLookupStart":287.39999997615814,"fetchStart":287.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":431.7000000476837,"responseEnd":654,"responseStart":644.8999999761581,"secureConnectionStart":287.39999997615814},{"duration":85.79999995231628,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":660.8000000715256,"connectEnd":660.8000000715256,"connectStart":660.8000000715256,"domainLookupEnd":660.8000000715256,"domainLookupStart":660.8000000715256,"fetchStart":660.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":705.8000000715256,"responseEnd":746.6000000238419,"responseStart":745.7000000476837,"secureConnectionStart":660.8000000715256}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":87,"responseStart":270,"responseEnd":287,"domLoading":273,"domInteractive":1162,"domContentLoadedEventStart":1162,"domContentLoadedEventEnd":1209,"domComplete":2779,"loadEventStart":2779,"loadEventEnd":2780,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1133.3000000715256},{"name":"bigPipe.sidebar-id.end","time":1134},{"name":"bigPipe.activity-panel-pipe-id.start","time":1134.2000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":1136.3999999761581},{"name":"activityTabFullyLoaded","time":1231.3000000715256}],"measures":[],"correlationId":"d1edfca75e065a","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":117,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Benchmark results from Axel, with a few plots added.