Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
N/A
Probably the setting set global InnoDB.optimizer_disk_read_ratio=0 is invalid, but the problem is that the test case below is derived directly from check_costs.pl script – when it's run on a debug build, it fails on the assertion.
So, something should change – either the script shouldn't be using it, or the assertion should be relaxed, or the invalid setting should be forbidden and/or automatically adjusted to the closest valid value.
--source include/have_innodb.inc
set global InnoDB.optimizer_disk_read_ratio=0;
create table check_costs_InnoDB (
`l_orderkey` int (11) NOT NULL ,
`l_partkey` int (11) DEFAULT NULL ,
`l_suppkey` int (11) DEFAULT NULL ,
`l_linenumber` int (11) NOT NULL ,
`l_extra` int (11) NOT NULL ,
`l_quantity` double DEFAULT NULL ,
`l_extendedprice` double DEFAULT NULL ,
`l_discount` double DEFAULT NULL ,
`l_tax` double DEFAULT NULL ,
`l_returnflag` char (1) DEFAULT NULL ,
`l_linestatus` char (1) DEFAULT NULL ,
`l_shipDATE` date DEFAULT NULL ,
`l_commitDATE` date DEFAULT NULL ,
`l_receiptDATE` date DEFAULT NULL ,
`l_shipinstruct` char (25) DEFAULT NULL ,
`l_shipmode` char (10) DEFAULT NULL ,
`l_comment` varchar (44) DEFAULT NULL ,
PRIMARY KEY (`l_orderkey`),
UNIQUE (`l_linenumber`),
UNIQUE (`l_extra`) ,
KEY `l_suppkey` (l_suppkey, l_partkey),
KEY `long_suppkey` (l_partkey, l_suppkey, l_linenumber, l_extra) )
ENGINE= InnoDB;
explain select count (*) from test.check_costs_InnoDB force index (l_suppkey) where l_suppkey >= 0 and l_partkey >=0;
bb-11.0 dd26d4f43
mariadbd: /data/src/bb-11.0/sql/handler.h:2832: double Cost_estimate::total_cost() const: Assertion `avg_io_cost != 0.0 || index_cost.io + row_cost.io == 0' failed.
230102 23:23:47 [ERROR] mysqld got signal 6 ;
#7 0x00007f20f8d6d662 in __GI___assert_fail (assertion=0x560ce1624028 "avg_io_cost != 0.0 || index_cost.io + row_cost.io == 0", file=0x560ce1624060 "/data/src/bb-11.0/sql/handler.h", line=2832, function=0x560ce1624080 "double Cost_estimate::total_cost() const") at assert.c:101
#8 0x0000560cdfb2ed47 in Cost_estimate::total_cost (this=0x7f20ec2d55f0) at /data/src/bb-11.0/sql/handler.h:2832
#9 0x0000560cdfaffaac in get_key_scans_params (param=0x7f20ec2d5890, tree=0x7f20c0067778, index_read_must_be_used=false, for_range_access=true, read_time=0.0059734050000000002, limit=18446744073709551615, using_table_scan=true) at /data/src/bb-11.0/sql/opt_range.cc:7771
#10 0x0000560cdfae937c in SQL_SELECT::test_quick_select (this=0x7f20c0063d58, thd=0x7f20c0000db8, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=true, only_single_index_range_scan=false) at /data/src/bb-11.0/sql/opt_range.cc:2975
#11 0x0000560cdfe91865 in get_quick_record_count (thd=0x7f20c0000db8, select=0x7f20c0063d58, table=0x7f20c012b878, keys=0x7f20c00188b8, limit=18446744073709551615) at /data/src/bb-11.0/sql/sql_select.cc:5169
#12 0x0000560cdfe961d8 in make_join_statistics (join=0x7f20c0017d30, tables_list=..., keyuse_array=0x7f20c0018088) at /data/src/bb-11.0/sql/sql_select.cc:5926
#13 0x0000560cdfe80014 in JOIN::optimize_inner (this=0x7f20c0017d30) at /data/src/bb-11.0/sql/sql_select.cc:2568
#14 0x0000560cdfe7b67a in JOIN::optimize (this=0x7f20c0017d30) at /data/src/bb-11.0/sql/sql_select.cc:1899
#15 0x0000560cdfe91295 in mysql_select (thd=0x7f20c0000db8, tables=0x7f20c0015d08, fields=..., conds=0x7f20c0016bf0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525828, result=0x7f20c0017690, unit=0x7f20c0005210, select_lex=0x7f20c0015608) at /data/src/bb-11.0/sql/sql_select.cc:5111
#16 0x0000560cdff0be4f in mysql_explain_union (thd=0x7f20c0000db8, unit=0x7f20c0005210, result=0x7f20c0017690) at /data/src/bb-11.0/sql/sql_select.cc:29413
#17 0x0000560cdfdc6a0c in execute_sqlcom_select (thd=0x7f20c0000db8, all_tables=0x7f20c0015d08) at /data/src/bb-11.0/sql/sql_parse.cc:6201
#18 0x0000560cdfdb3b91 in mysql_execute_command (thd=0x7f20c0000db8, is_called_from_prepared_stmt=false) at /data/src/bb-11.0/sql/sql_parse.cc:3947
#19 0x0000560cdfdd02ae in mysql_parse (thd=0x7f20c0000db8, rawbuf=0x7f20c00154c0 "explain select count(*) from test.check_costs_InnoDB force index (l_suppkey) where l_suppkey >= 0 and l_partkey >=0", length=115, parser_state=0x7f20ec2d7390) at /data/src/bb-11.0/sql/sql_parse.cc:7998
#20 0x0000560cdfda7756 in dispatch_command (command=COM_QUERY, thd=0x7f20c0000db8, packet=0x7f20c000ba49 "", packet_length=115, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1894
#21 0x0000560cdfda4911 in do_command (thd=0x7f20c0000db8, blocking=true) at /data/src/bb-11.0/sql/sql_parse.cc:1407
#22 0x0000560ce011cd9a in do_handle_one_connection (connect=0x560ce56ee5e8, put_in_cache=true) at /data/src/bb-11.0/sql/sql_connect.cc:1415
#23 0x0000560ce011c790 in handle_one_connection (arg=0x560ce572b608) at /data/src/bb-11.0/sql/sql_connect.cc:1317
#24 0x0000560ce0a34e09 in pfs_spawn_thread (arg=0x560ce56ee158) at /data/src/bb-11.0/storage/perfschema/pfs.cc:2201
#25 0x00007f20f9249ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#26 0x00007f20f8e38aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
is caused by
MDEV-26974
Improve selectivity and related costs in optimizer
Closed
{"report":{"fcp":856,"ttfb":229.69999980926514,"pageVisibility":"visible","entityId":117954,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"d2a998d1-1458-4cce-ad53-4eb962edd579","navigationType":0,"readyForUser":947.6999998092651,"redirectCount":0,"resourceLoadedEnd":580,"resourceLoadedStart":237.19999980926514,"resourceTiming":[{"duration":8.300000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":237.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":237.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":245.5,"responseStart":0,"secureConnectionStart":0},{"duration":8.299999952316284,"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":237.39999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":237.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":245.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":215.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":237.5,"connectEnd":237.5,"connectStart":237.5,"domainLookupEnd":237.5,"domainLookupStart":237.5,"fetchStart":237.5,"redirectEnd":0,"redirectStart":0,"requestStart":256.5,"responseEnd":452.59999990463257,"responseStart":277.5,"secureConnectionStart":237.5},{"duration":342.40000009536743,"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":237.59999990463257,"connectEnd":237.59999990463257,"connectStart":237.59999990463257,"domainLookupEnd":237.59999990463257,"domainLookupStart":237.59999990463257,"fetchStart":237.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":257.09999990463257,"responseEnd":580,"responseStart":284.69999980926514,"secureConnectionStart":237.59999990463257},{"duration":43.80000019073486,"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":237.69999980926514,"connectEnd":237.69999980926514,"connectStart":237.69999980926514,"domainLookupEnd":237.69999980926514,"domainLookupStart":237.69999980926514,"fetchStart":237.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":255.59999990463257,"responseEnd":281.5,"responseStart":276.2999999523163,"secureConnectionStart":237.69999980926514},{"duration":43.89999985694885,"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":237.79999995231628,"connectEnd":237.79999995231628,"connectStart":237.79999995231628,"domainLookupEnd":237.79999995231628,"domainLookupStart":237.79999995231628,"fetchStart":237.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":256.7999999523163,"responseEnd":281.69999980926514,"responseStart":278.39999985694885,"secureConnectionStart":237.79999995231628},{"duration":50.799999952316284,"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":237.89999985694885,"connectEnd":237.89999985694885,"connectStart":237.89999985694885,"domainLookupEnd":237.89999985694885,"domainLookupStart":237.89999985694885,"fetchStart":237.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":256.89999985694885,"responseEnd":288.69999980926514,"responseStart":283.69999980926514,"secureConnectionStart":237.89999985694885},{"duration":12.599999904632568,"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":238,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":238,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":250.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":54.200000047683716,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":238.19999980926514,"connectEnd":238.19999980926514,"connectStart":238.19999980926514,"domainLookupEnd":238.19999980926514,"domainLookupStart":238.19999980926514,"fetchStart":238.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":258.59999990463257,"responseEnd":292.39999985694885,"responseStart":289,"secureConnectionStart":238.19999980926514},{"duration":12.799999952316284,"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":238.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":238.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":251.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":55.299999952316284,"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":238.39999985694885,"connectEnd":238.39999985694885,"connectStart":238.39999985694885,"domainLookupEnd":238.39999985694885,"domainLookupStart":238.39999985694885,"fetchStart":238.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":258.69999980926514,"responseEnd":293.69999980926514,"responseStart":289.7999999523163,"secureConnectionStart":238.39999985694885},{"duration":279,"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":243.69999980926514,"connectEnd":243.69999980926514,"connectStart":243.69999980926514,"domainLookupEnd":243.69999980926514,"domainLookupStart":243.69999980926514,"fetchStart":243.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":275.7999999523163,"responseEnd":522.6999998092651,"responseStart":514.2999999523163,"secureConnectionStart":243.69999980926514},{"duration":279.2999999523163,"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":243.79999995231628,"connectEnd":243.79999995231628,"connectStart":243.79999995231628,"domainLookupEnd":243.79999995231628,"domainLookupStart":243.79999995231628,"fetchStart":243.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":293.2999999523163,"responseEnd":523.0999999046326,"responseStart":516.1999998092651,"secureConnectionStart":243.79999995231628},{"duration":156.10000014305115,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":602.6999998092651,"connectEnd":602.6999998092651,"connectStart":602.6999998092651,"domainLookupEnd":602.6999998092651,"domainLookupStart":602.6999998092651,"fetchStart":602.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":730.0999999046326,"responseEnd":758.7999999523163,"responseStart":758.1999998092651,"secureConnectionStart":602.6999998092651},{"duration":194.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":808,"connectEnd":808,"connectStart":808,"domainLookupEnd":808,"domainLookupStart":808,"fetchStart":808,"redirectEnd":0,"redirectStart":0,"requestStart":974.1999998092651,"responseEnd":1002.5999999046326,"responseStart":1001.5999999046326,"secureConnectionStart":808},{"duration":168.29999995231628,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":845.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":845.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1013.5999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":74,"responseStart":230,"responseEnd":236,"domLoading":233,"domInteractive":1052,"domContentLoadedEventStart":1052,"domContentLoadedEventEnd":1100,"domComplete":1914,"loadEventStart":1914,"loadEventEnd":1916,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1028.3999998569489},{"name":"bigPipe.sidebar-id.end","time":1029.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1029.3999998569489},{"name":"bigPipe.activity-panel-pipe-id.end","time":1032},{"name":"activityTabFullyLoaded","time":1112.3999998569489}],"measures":[],"correlationId":"487150fbfb8490","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":75,"dbReadsTimeInMs":11,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}