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.
This commit is contained in:
unknown 2010-04-02 17:27:06 +03:00
parent cb325eb2b2
commit 3fc85580c9

View File

@ -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()
/* 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()
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;
} }