MySQL???????????
???????????? ???????[ 2012/8/10 9:46:09 ] ????????
/* If result table is small; use a heap */
/* future: storage engine selection can be made dynamic? */
if ( blob_count || using_unique_constraint
|| ( thd->variables .big_tables && !( select_options & SELECT_SMALL_RESULT ))
|| ( select_options & TMP_TABLE_FORCE_MYISAM ))
{
share->db_plugin = ha_lock_engine(0?? myisam_hton);
table->file = get_new_handler( share?? &table ->mem_root??
share->db_type ());
if (group &&
( param->group_parts > table-> file->max_key_parts () ||
param->group_length > table-> file->max_key_length ()))
using_unique_constraint=1;
}
else
{
share->db_plugin = ha_lock_engine(0?? heap_hton);
table->file = get_new_handler( share?? &table ->mem_root??
share->db_type ());
}
????????????sql_select.cc:11224????????create_myisam_from_heap()??λ???sql_select.cc:11287
/*
copy all old rows from heap table to MyISAM table
This is the only code that uses record[1] to read/write but this
is safe as this is a temporary MyISAM table without timestamp/autoincrement
or partitioning.
*/
while (! table->file ->rnd_next( new_table.record [1]))
{
write_err= new_table .file-> ha_write_row(new_table .record[1]);
DBUG_EXECUTE_IF("raise_error" ?? write_err= HA_ERR_FOUND_DUPP_KEY ;);
if (write_err )
goto err ;
}
?????????????????
????????????????????????????????MySQL????????????????????????????
????????????????????
????1?????order by??????group by?????????????????order by??group by?????join?????е??????????Ρ?
????2??DISTINCT????order by??????????
????3??????????SQL_SMALL_RESULT???MySQL???memory?????????????????????洢???????
?????????????????????
????1????????BLOB??TEXT?????
????2??group by??distinct?????е???δ???512??????
????3??????????UNION??UNION ALL???κβ???б??е???δ???512??????
?????????????????tmp_table_size??max_heap_table_size??С???????????????????myisam?洢????洢???????
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11