Comment 3 for bug 823930

Revision history for this message
Sergey Petrunia (sergefp) wrote :

In the case of non-semijoin materialization, we proceed as far as entering
subselect_hash_sj_engine::init(). Inside that function, we execute up to this
code:

  if (result_sink->create_result_table(thd, tmp_columns, TRUE,
                                       tmp_create_options,
           name, TRUE, TRUE))
    DBUG_RETURN(TRUE);

  tmp_table= result_sink->table;
  result= result_sink;

  /*
    If the subquery has blobs, or the total key lenght is bigger than
    some length, or the total number of key parts is more than the
    allowed maximum (currently MAX_REF_PARTS == 16), then the created
    index cannot be used for lookups and we can't use hash semi
    join. If this is the case, delete the temporary table since it
    will not be used, and tell the caller we failed to initialize the
    engine.
  */
  if (tmp_table->s->keys == 0)
  {

And then we find out that "tmp_table->s->keys == 0" which causes us not to use
materialization strategy, and switch to IN->EXISTS instead.