Commit 898e3a04 authored by unknown's avatar unknown

MWL#68: Subquery optimization: Efficient NOT IN execution with NULLs

Fixed an error where the priority queue for the indexes used for partial
matching was not emptied after each execution in all cases.
parent c7ce1855
...@@ -3882,8 +3882,9 @@ subselect_hash_sj_engine::make_unique_engine() ...@@ -3882,8 +3882,9 @@ subselect_hash_sj_engine::make_unique_engine()
cur_ref_buff + test(maybe_null), we could cur_ref_buff + test(maybe_null), we could
use that information instead. use that information instead.
*/ */
cur_ref_buff + null_count, cur_ref_buff + null_count,
null_count ? tab->ref.key_buff : 0, null_count ? cur_ref_buff : 0,
cur_key_part->length, tab->ref.items[i]); cur_key_part->length, tab->ref.items[i]);
cur_ref_buff+= cur_key_part->store_length; cur_ref_buff+= cur_key_part->store_length;
} }
...@@ -4908,6 +4909,8 @@ bool subselect_rowid_merge_engine::partial_match() ...@@ -4908,6 +4909,8 @@ bool subselect_rowid_merge_engine::partial_match()
/* If there is a non-NULL key, it must be the first key in the keys array. */ /* If there is a non-NULL key, it must be the first key in the keys array. */
DBUG_ASSERT(!non_null_key || (non_null_key && merge_keys[0] == non_null_key)); DBUG_ASSERT(!non_null_key || (non_null_key && merge_keys[0] == non_null_key));
/* The prioryty queue for keys must be empty. */
DBUG_ASSERT(!pq.elements);
/* All data accesses during execution are via handler::ha_rnd_pos() */ /* All data accesses during execution are via handler::ha_rnd_pos() */
tmp_table->file->ha_rnd_init(0); tmp_table->file->ha_rnd_init(0);
...@@ -5031,6 +5034,7 @@ bool subselect_rowid_merge_engine::partial_match() ...@@ -5031,6 +5034,7 @@ bool subselect_rowid_merge_engine::partial_match()
DBUG_ASSERT(FALSE); DBUG_ASSERT(FALSE);
end: end:
queue_remove_all(&pq);
tmp_table->file->ha_rnd_end(); tmp_table->file->ha_rnd_end();
return res; return res;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment