Details
Description
The data in the test case is an excerpt from the dbt3 data set. Many rows and some tables have been removed, but nothing added.
Apparently the problem occurs when there is no EITS statistics collected, or when the query is run with use_stat_tables=NEVER.
The test case keeps the default use_stat_tables, to make it more realistic. This exact version fails every time for me, but it seemed to be rather flimsy in the process. It may depend on timing related to InnoDB statistics, or something else.
If it's not failing for you, try adding SET use_stat_tables=NEVER before the query.
--source include/have_innodb.inc
|
|
CREATE TABLE lineitem (l_orderkey int(11) NOT NULL DEFAULT '0', l_partkey int(11) DEFAULT NULL, l_suppkey int(11) DEFAULT NULL, l_linenumber int(11) NOT NULL DEFAULT '0', 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,l_linenumber), KEY i_l_shipdate (l_shipDATE), KEY i_l_suppkey_partkey (l_partkey,l_suppkey), KEY i_l_partkey (l_partkey), KEY i_l_suppkey (l_suppkey), KEY i_l_receiptdate (l_receiptDATE), KEY i_l_orderkey (l_orderkey), KEY i_l_orderkey_quantity (l_orderkey,l_quantity), KEY i_l_commitdate (l_commitDATE)) ENGINE=InnoDB; |
CREATE TABLE part (p_partkey int(11) NOT NULL, p_name varchar(55) DEFAULT NULL, p_mfgr char(25) DEFAULT NULL, p_brand char(10) DEFAULT NULL, p_type varchar(25) DEFAULT NULL, p_size int(11) DEFAULT NULL, p_container char(10) DEFAULT NULL, p_retailprice double DEFAULT NULL, p_comment varchar(23) DEFAULT NULL, PRIMARY KEY (p_partkey)) ENGINE=InnoDB; |
CREATE TABLE partsupp (ps_partkey int(11) NOT NULL DEFAULT '0', ps_suppkey int(11) NOT NULL DEFAULT '0', ps_availqty int(11) DEFAULT NULL, ps_supplycost double DEFAULT NULL, ps_comment varchar(199) DEFAULT NULL, PRIMARY KEY (ps_partkey,ps_suppkey), KEY i_ps_partkey (ps_partkey), KEY i_ps_suppkey (ps_suppkey)) ENGINE=InnoDB; |
INSERT INTO lineitem VALUES (581,7,1,1,41,37187,0.09,0.07,'N','O','1997-05-26','1997-04-06','1997-06-10','TAKE BACK RETURN','MAIL','even, bold excuses about the'),(581,10,1,2,14,12740.14,0.06,0.08,'N','O','1997-05-17','1997-04-14','1997-06-08','NONE','MAIL','furiously silent depths'),(581,11,1,3,49,44639.49,0.1,0.02,'N','O','1997-02-27','1997-04-24','1997-03-10','TAKE BACK RETURN','MAIL','furiously regular theodolites wake qu'),(581,8,1,4,30,27240,0.1,0.08,'N','O','1997-06-19','1997-05-21','1997-06-22','TAKE BACK RETURN','TRUCK','even deposits wa'),(582,6,1,1,7,6342,0.07,0,'N','O','1997-11-16','1997-11-29','1997-12-10','TAKE BACK RETURN','FOB','carefully final requests sleep slyly. even,'),(582,6,1,2,49,44394,0.05,0.03,'N','O','1997-12-17','1998-01-12','1997-12-31','COLLECT COD','REG AIR','carefully regular'),(582,15,1,3,42,38430.42,0.07,0,'N','O','1997-11-15','1997-12-21','1997-12-03','COLLECT COD','SHIP','pending, spe'),(582,17,1,4,36,33012.36,0.06,0.01,'N','O','1997-12-09','1997-11-27','1997-12-26','TAKE BACK RETURN','SHIP','slyly final foxes nag permanen'); |
INSERT INTO part VALUES (1,'goldenrod lace spring peru powder','Manufacturer#1','Brand#13','PROMO BURNISHED COPPER',7,'JUMBO PKG',901,'final deposits s'),(2,'blush rosy metallic lemon navajo','Manufacturer#1','Brand#13','LARGE BRUSHED BRASS',1,'LG CASE',902,'final platelets hang f'),(3,'dark green antique puff wheat','Manufacturer#4','Brand#42','STANDARD POLISHED BRASS',21,'WRAP CASE',903,'unusual excuses ac'),(4,'chocolate metallic smoke ghost drab','Manufacturer#3','Brand#34','SMALL PLATED BRASS',14,'MED DRUM',904,'ironi'),(5,'forest blush chiffon thistle chocolate','Manufacturer#3','Brand#32','STANDARD POLISHED TIN',15,'SM PKG',905,'pending, spe'),(6,'white ivory azure firebrick black','Manufacturer#2','Brand#24','PROMO PLATED STEEL',4,'MED BAG',906,'pending pinto be'),(7,'blue blanched tan indian olive','Manufacturer#1','Brand#11','SMALL PLATED COPPER',45,'SM BAG',907,'blithely ironic'); |
INSERT INTO partsupp VALUES (1,1,3325,771.64,'requests after the carefully ironic ideas cajole alongside of the enticingly special accounts. fluffily regular deposits haggle about the blithely ironic deposits. regular requests sleep c'),(2,1,8895,378.49,'furiously even asymptotes are furiously regular plate'),(3,1,4651,920.92,'ironic, pending theodolites sleep slyly at the slyly final foxes. slyly ironic accounts sleep express accounts. quickly fina'),(4,1,1339,113.97,'furiously even accounts sleep. slyly regular deposits hag'),(5,1,3735,255.88,'even, ironic requests snooze blithely throughout the carefully pending deposits. busy deposits mold blithely after the furiously final pinto beans. regular, unus'),(6,1,8851,130.72,'carefully regular asymptotes wake slyly according to the quickly re'),(7,1,7454,763.98,'carefully even ideas should wake. blithely final instructions are special foxes. pending, ironic requests wake blithely about the furiously regular foxes. ironic idea'),(8,1,6834,249.63,'furiously unusual instructions use quickly. unusual deposits among the regular deposits doze unusual epitaph'),(9,1,7054,84.2,'final ideas through the requests boost quickly about the furiously regular accounts. blithely silent foxes affix carefully ironic instructions. blithely bold foxe'),(10,1,2952,996.12,'blithely even foxes nag furiously about the quickly ex'),(11,1,4540,709.87,'final packages mold after the carefully unusual requests. quickly fi'),(12,1,3610,659.73,'unusual dolphins sleep slyly. ironic deposits use fluffily. carefully unusual platelets poach slyly. evenly pending deposits nag ironi'),(13,1,612,169.44,'blithely special theodolites serve quickly. regular deposits are alongside of the fluffily sl'),(14,1,5278,650.07,'quickly even deposits doze quickly pending, bold deposits. carefully regular packages sublate carefully'),(15,1,7047,835.7,'packages haggle across the carefully express ideas. slyly bold instructions promise even, express packages. furiously ironic acc'); |
|
SELECT ps_suppkey FROM part |
JOIN partsupp ON (p_partkey = ps_partkey) |
JOIN lineitem ON (ps_partkey = l_partkey AND ps_suppkey = l_suppkey) |
WHERE p_partkey != 222 ORDER BY 1 LIMIT 1; |
11.0 5fb2c031 |
mariadbd: /data/src/11.0/sql/sql_select.cc:31489: bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*): Assertion `cond_selectivity <= 1.000000001' failed.
|
230620 0:10:58 [ERROR] mysqld got signal 6 ;
|
|
#9 0x00007f4842e53df2 in __GI___assert_fail (assertion=0x5635fad3ee60 "cond_selectivity <= 1.000000001", file=0x5635fad2c680 "/data/src/11.0/sql/sql_select.cc", line=31489, function=0x5635fad3eea0 "bool get_range_limit_read_cost(const POSITION*, const TABLE*, uint, ha_rows, ha_rows, double*, double*)") at ./assert/assert.c:101
|
#10 0x00005635f8e41f4c in get_range_limit_read_cost (pos=0x6290004e9708, table=0x6190000f9198, keynr=4, rows_limit_arg=1, rows_to_scan=1, read_cost=0x7f48304cfba0, read_rows=0x7f48304cfbc0) at /data/src/11.0/sql/sql_select.cc:31489
|
#11 0x00005635f8e43e70 in test_if_cheaper_ordering (tab=0x62900052d238, order=0x6290004e2e70, table=0x6190000f9198, usable_keys=..., ref_key=2, select_limit_arg=1, new_key=0x7f48304cfea0, new_key_direction=0x7f48304cfed0, new_select_limit=0x7f48304cff60, new_used_key_parts=0x7f48304cfeb0, saved_best_key_parts=0x7f48304cfec0) at /data/src/11.0/sql/sql_select.cc:31849
|
#12 0x00005635f8e1b57a in test_if_skip_sort_order (tab=0x62900052d238, order=0x6290004e2e70, select_limit=1, no_changes=false, map=0x6190000f9230) at /data/src/11.0/sql/sql_select.cc:26390
|
#13 0x00005635f8d7110e in JOIN::optimize_stage2 (this=0x6290004e3048) at /data/src/11.0/sql/sql_select.cc:3344
|
#14 0x00005635f8d69af1 in JOIN::optimize_inner (this=0x6290004e3048) at /data/src/11.0/sql/sql_select.cc:2633
|
#15 0x00005635f8d62845 in JOIN::optimize (this=0x6290004e3048) at /data/src/11.0/sql/sql_select.cc:1935
|
#16 0x00005635f8d842d9 in mysql_select (thd=0x62b00017a218, tables=0x6290000faa80, fields=..., conds=0x6290004e2360, og_num=1, order=0x6290004e2e70, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6290004e3018, unit=0x62b00017e660, select_lex=0x6290000fa410) at /data/src/11.0/sql/sql_select.cc:5168
|
#17 0x00005635f8d53fe8 in handle_select (thd=0x62b00017a218, lex=0x62b00017e588, result=0x6290004e3018, setup_tables_done_option=0) at /data/src/11.0/sql/sql_select.cc:626
|
#18 0x00005635f8c7974e in execute_sqlcom_select (thd=0x62b00017a218, all_tables=0x6290000faa80) at /data/src/11.0/sql/sql_parse.cc:6279
|
#19 0x00005635f8c67b75 in mysql_execute_command (thd=0x62b00017a218, is_called_from_prepared_stmt=false) at /data/src/11.0/sql/sql_parse.cc:3949
|
#20 0x00005635f8c841fe in mysql_parse (thd=0x62b00017a218, rawbuf=0x6290000fa238 "SELECT ps_suppkey FROM part JOIN partsupp ON (p_partkey = ps_partkey) JOIN lineitem ON (ps_partkey = l_partkey AND ps_suppkey = l_suppkey) WHERE p_partkey != 222 ORDER BY 1 LIMIT 1", length=180, parser_state=0x7f48304d1a20) at /data/src/11.0/sql/sql_parse.cc:8014
|
#21 0x00005635f8c5a0ea in dispatch_command (command=COM_QUERY, thd=0x62b00017a218, packet=0x629000285219 "SELECT ps_suppkey FROM part JOIN partsupp ON (p_partkey = ps_partkey) JOIN lineitem ON (ps_partkey = l_partkey AND ps_suppkey = l_suppkey) WHERE p_partkey != 222 ORDER BY 1 LIMIT 1", packet_length=180, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1894
|
#22 0x00005635f8c56e03 in do_command (thd=0x62b00017a218, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1407
|
#23 0x00005635f9120336 in do_handle_one_connection (connect=0x608000003938, put_in_cache=true) at /data/src/11.0/sql/sql_connect.cc:1416
|
#24 0x00005635f911fcf7 in handle_one_connection (arg=0x6080000038b8) at /data/src/11.0/sql/sql_connect.cc:1318
|
#25 0x00005635f9d17a1c in pfs_spawn_thread (arg=0x617000008218) at /data/src/11.0/storage/perfschema/pfs.cc:2201
|
#26 0x00007f4842ea7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
|
#27 0x00007f4842f285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
|
From the coredump:
(gdb) f 10
|
#10 0x000055a1a73d0f4c in get_range_limit_read_cost (pos=0x6290004e9708, table=0x6190000f9198, keynr=4, rows_limit_arg=1, rows_to_scan=1,
|
read_cost=0x7f13be55aba0, read_rows=0x7f13be55abc0) at /data/src/11.0/sql/sql_select.cc:31489
|
31489 DBUG_ASSERT(cond_selectivity <= 1.000000001);
|
(gdb) p cond_selectivity
|
$1 = 1.125
|