| 22435 | |
| 22436 | |
| 22437 | bool Create_tmp_table::choose_engine(THD *thd, TABLE *table, |
| 22438 | TMP_TABLE_PARAM *param) |
| 22439 | { |
| 22440 | TABLE_SHARE *share= table->s; |
| 22441 | DBUG_ENTER("Create_tmp_table::choose_engine"); |
| 22442 | /* |
| 22443 | If result table is small; use a heap, otherwise TMP_TABLE_HTON (Aria) |
| 22444 | In the future we should try making storage engine selection more dynamic |
| 22445 | */ |
| 22446 | |
| 22447 | if (share->blob_fields || m_using_unique_constraint || |
| 22448 | (m_select_options & TMP_TABLE_FORCE_MYISAM) || |
| 22449 | thd->variables.tmp_memory_table_size == 0) |
| 22450 | { |
| 22451 | share->db_plugin= ha_lock_engine(0, TMP_ENGINE_HTON); |
| 22452 | table->file= get_new_handler(share, &table->mem_root, |
| 22453 | share->db_type()); |
| 22454 | if (m_group && |
| 22455 | (param->group_parts > table->file->max_key_parts() || |
| 22456 | param->group_length > table->file->max_key_length())) |
| 22457 | m_using_unique_constraint= true; |
| 22458 | } |
| 22459 | else |
| 22460 | { |
| 22461 | share->db_plugin= ha_lock_engine(0, heap_hton); |
| 22462 | table->file= get_new_handler(share, &table->mem_root, |
| 22463 | share->db_type()); |
| 22464 | } |
| 22465 | DBUG_RETURN(!table->file); |
| 22466 | } |
| 22467 | |
| 22468 | |
| 22469 | bool Create_tmp_table::finalize(THD *thd, |
nothing calls this directly
no test coverage detected