mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
BNLH algorithm always used a full table scan over the joined table
even in the cases when there existed range/index-merge scans that were cheaper than the full table scan. This was a defect/bug of the implementation of mwl #128. Now hash join can work not only with full table scan of the joined table, but also with full index scan, range and index-merge scans. Accordingly, in the cases when hash join is used the column 'type' in the EXPLAINs can contain now 'hash_ALL', 'hash_index', 'hash_range' and 'hash_index_merge'. If hash join is coupled with a range/index_merge scan then the columns 'key' and 'key_len' contain info not only on the used hash index, but also on the indexes used for the scan.
This commit is contained in:
@ -2656,7 +2656,7 @@ SELECT t1.pk FROM t1,t2
|
||||
WHERE t1.pk = t2.pk AND t2.pk <> 8;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 11 Using where; Using index
|
||||
1 SIMPLE t2 hash PRIMARY PRIMARY 4 test.t1.pk 13 Using index; Using join buffer (flat, BNLH join)
|
||||
1 SIMPLE t2 hash_range PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.pk 7 Using where; Using index; Using join buffer (flat, BNLH join)
|
||||
SELECT t1.pk FROM t1,t2
|
||||
WHERE t1.pk = t2.pk AND t2.pk <> 8;
|
||||
pk
|
||||
|
Reference in New Issue
Block a user