MariaDB [dbt3]> analyze -> select straight_join count(*) AS cnt -> from -> supplier, lineitem, orders, customer, part, partsupp -> where -> customer.c_custkey = orders.o_custkey and orders.o_orderkey = lineitem.l_orderkey and -> partsupp.ps_suppkey = supplier.s_suppkey and lineitem.l_suppkey = supplier.s_suppkey and -> part.p_partkey = partsupp.ps_partkey and partsupp.ps_partkey < 130 -> and partsupp.ps_comment is not null -> having cnt < 0; +------+-------------+----------+--------+--------------------------------------------------------+-------------+---------+---------------------------------------------+------+--------+----------+------------+--------------------------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra | +------+-------------+----------+--------+--------------------------------------------------------+-------------+---------+---------------------------------------------+------+--------+----------+------------+--------------------------------------------------------------+ | 1 | SIMPLE | supplier | index | PRIMARY | PRIMARY | 4 | NULL | 10 | 10.00 | 100.00 | 100.00 | Using index | | 1 | SIMPLE | lineitem | ref | PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity | i_l_suppkey | 5 | dbt3.supplier.s_suppkey | 600 | 600.50 | 100.00 | 100.00 | | | 1 | SIMPLE | orders | eq_ref | PRIMARY,i_o_custkey | PRIMARY | 4 | dbt3.lineitem.l_orderkey | 1 | 1.00 | 100.00 | 100.00 | Using where | | 1 | SIMPLE | customer | eq_ref | PRIMARY | PRIMARY | 4 | dbt3.orders.o_custkey | 1 | 1.00 | 100.00 | 100.00 | Using index | | 1 | SIMPLE | part | range | PRIMARY | PRIMARY | 4 | NULL | 129 | 129.00 | 100.00 | 100.00 | Using where; Using index; Using join buffer (flat, BNL join) | | 1 | SIMPLE | partsupp | eq_ref | PRIMARY,i_ps_partkey,i_ps_suppkey | PRIMARY | 8 | dbt3.part.p_partkey,dbt3.supplier.s_suppkey | 1 | 0.36 | 100.00 | 100.00 | Using where | +------+-------------+----------+--------+--------------------------------------------------------+-------------+---------+---------------------------------------------+------+--------+----------+------------+--------------------------------------------------------------+ 6 rows in set (0.722 sec) MariaDB [dbt3]> set join_cache_level=0; Query OK, 0 rows affected (0.001 sec) MariaDB [dbt3]> analyze select straight_join count(*) AS cnt from supplier, lineitem, orders, customer, part, partsupp where customer.c_custkey = orders.o_custkey and orders.o_orderkey = lineitem.l_orderkey and partsupp.ps_suppkey = supplier.s_suppkey and lineitem.l_suppkey = supplier.s_suppkey and part.p_partkey = partsupp.ps_partkey and partsupp.ps_partkey < 130 and partsupp.ps_comment is not null having cnt < 0; +------+-------------+----------+--------+--------------------------------------------------------+-------------+---------+---------------------------------------------+------+--------+----------+------------+--------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra | +------+-------------+----------+--------+--------------------------------------------------------+-------------+---------+---------------------------------------------+------+--------+----------+------------+--------------------------+ | 1 | SIMPLE | supplier | index | PRIMARY | PRIMARY | 4 | NULL | 10 | 10.00 | 100.00 | 100.00 | Using index | | 1 | SIMPLE | lineitem | ref | PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity | i_l_suppkey | 5 | dbt3.supplier.s_suppkey | 600 | 600.50 | 100.00 | 100.00 | | | 1 | SIMPLE | orders | eq_ref | PRIMARY,i_o_custkey | PRIMARY | 4 | dbt3.lineitem.l_orderkey | 1 | 1.00 | 100.00 | 100.00 | Using where | | 1 | SIMPLE | customer | eq_ref | PRIMARY | PRIMARY | 4 | dbt3.orders.o_custkey | 1 | 1.00 | 100.00 | 100.00 | Using index | | 1 | SIMPLE | part | range | PRIMARY | PRIMARY | 4 | NULL | 129 | 129.00 | 100.00 | 100.00 | Using where; Using index | | 1 | SIMPLE | partsupp | eq_ref | PRIMARY,i_ps_partkey,i_ps_suppkey | PRIMARY | 8 | dbt3.part.p_partkey,dbt3.supplier.s_suppkey | 1 | 0.36 | 100.00 | 100.00 | Using where | +------+-------------+----------+--------+--------------------------------------------------------+-------------+---------+---------------------------------------------+------+--------+----------+------------+--------------------------+ 6 rows in set (17.422 sec)