4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
where s_suppkey in (select ps_suppkey from partsupp
where ps_partkey in (select p_partkey from part
where p_name like 'g%')
and ps_availqty >
(select 0.5 * sum(l_quantity)
from lineitem
where l_partkey = ps_partkey
and l_suppkey = ps_suppkey
and l_shipdate >= date('1993-01-01')
and l_shipdate < date('1993-01-01') +
interval '1' year ))
and s_nationkey = n_nationkey
and n_name = 'UNITED STATES'
order by s_name
limit 10;
s_name s_address
Supplier#000000010 Saygah3gYWMp72i PY
set histogram_type='SINGLE_PREC_HB';
set histogram_size=24;
flush table nation;
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
Table Op Msg_type Msg_text
dbt3_s001.nation analyze status Table is already up to date
flush table nation;
EXPLAIN EXTENDED select sql_calc_found_rows
s_name, s_address
from supplier, nation
...
...
@@ -218,6 +278,7 @@ limit 10;
s_name s_address
Supplier#000000010 Saygah3gYWMp72i PY
DROP DATABASE dbt3_s001;
set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 6.25 Using where
2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.37 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
where s_suppkey in (select ps_suppkey from partsupp
where ps_partkey in (select p_partkey from part
where p_name like 'g%')
and ps_availqty >
(select 0.5 * sum(l_quantity)
from lineitem
where l_partkey = ps_partkey
and l_suppkey = ps_suppkey
and l_shipdate >= date('1993-01-01')
and l_shipdate < date('1993-01-01') +
interval '1' year ))
and s_nationkey = n_nationkey
and n_name = 'UNITED STATES'
order by s_name
limit 10;
s_name s_address
Supplier#000000010 Saygah3gYWMp72i PY
set histogram_type='SINGLE_PREC_HB';
set histogram_size=24;
flush table nation;
ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
Table Op Msg_type Msg_text
dbt3_s001.nation analyze status OK
flush table nation;
EXPLAIN EXTENDED select sql_calc_found_rows
s_name, s_address
from supplier, nation
...
...
@@ -223,6 +284,7 @@ limit 10;
s_name s_address
Supplier#000000010 Saygah3gYWMp72i PY
DROP DATABASE dbt3_s001;
set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
@@ -108,6 +108,6 @@ set @had_proxies_priv_table= @@warning_count != 0;
CREATETABLEIFNOTEXISTStable_stats(db_namevarchar(64)NOTNULL,table_namevarchar(64)NOTNULL,cardinalitybigint(21)unsignedDEFAULTNULL,PRIMARYKEY(db_name,table_name))ENGINE=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Statistics on Tables';
CREATETABLEIFNOTEXISTScolumn_stats(db_namevarchar(64)NOTNULL,table_namevarchar(64)NOTNULL,column_namevarchar(64)NOTNULL,min_valuevarchar(255)DEFAULTNULL,max_valuevarchar(255)DEFAULTNULL,nulls_ratiodecimal(12,4)DEFAULTNULL,avg_lengthdecimal(12,4)DEFAULTNULL,avg_frequencydecimal(12,4)DEFAULTNULL,hist_sizetinyintunsigned,histogramvarbinary(255),PRIMARYKEY(db_name,table_name,column_name))ENGINE=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Statistics on Columns';
CREATETABLEIFNOTEXISTScolumn_stats(db_namevarchar(64)NOTNULL,table_namevarchar(64)NOTNULL,column_namevarchar(64)NOTNULL,min_valuevarchar(255)DEFAULTNULL,max_valuevarchar(255)DEFAULTNULL,nulls_ratiodecimal(12,4)DEFAULTNULL,avg_lengthdecimal(12,4)DEFAULTNULL,avg_frequencydecimal(12,4)DEFAULTNULL,hist_sizetinyintunsigned,hist_typeenum('SINGLE_PREC_HB','DOUBLE_PREC_HB'),histogramvarbinary(255),PRIMARYKEY(db_name,table_name,column_name))ENGINE=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Statistics on Columns';
CREATETABLEIFNOTEXISTSindex_stats(db_namevarchar(64)NOTNULL,table_namevarchar(64)NOTNULL,index_namevarchar(64)NOTNULL,prefix_arityint(11)unsignedNOTNULL,avg_frequencydecimal(12,4)DEFAULTNULL,PRIMARYKEY(db_name,table_name,index_name,prefix_arity))ENGINE=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Statistics on Indexes';