MCPcopy Create free account
hub / github.com/MariaDB/server / choose_engine

Method choose_engine

sql/sql_select.cc:22437–22466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22435
22436
22437bool 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
22469bool Create_tmp_table::finalize(THD *thd,

Callers

nothing calls this directly

Calls 5

ha_lock_engineFunction · 0.85
get_new_handlerFunction · 0.85
db_typeMethod · 0.80
max_key_partsMethod · 0.45
max_key_lengthMethod · 0.45

Tested by

no test coverage detected