MySQL如何创建和删除临时表(2)
2)断点:mysql_create_table
mysql_create_table
mysql_create_table_no_lock
check_engine
file = get_new_handler
3842 set_table_default_charset(thd, create_info, (char*) db);
3844 if (mysql_prepare_create_table(thd, create_info, alter_info,
3854 path_length= build_tmptable_filename(thd, path, sizeof(path)); -----创建临时表文件名:#sql{进程id}_{thread_id}_{当前线程的临时表整数标识thd->tmp_table}
3978 rea_create_table --------------------------------------------------------------------创建frm文件和ibd文件
3986 open_temporary_table-------------------------------------------------------------打开临时表
(1)构建table和table_share结构体
(2)将table结构体加入到thd->temporary_tables链表中
4009 error= write_create_table_bin_log----------------------------------------------写入binlog
3.删除临时表
手动执行 drop table tmp1
mysql_execute_command
case SQLCOM_DROP_TABLE:
mysql_rm_table
mysql_rm_table_part2
for (table= tables; table; table= table->next_local)
drop_temporary_table-----------------------------从thd->temporary_tables上查找临时表
调用close_temporary_table来关闭、删除临时表文件,并从thd->temporary_tables上删除相应节点
相关新闻>>
- 发表评论
-
- 最新评论 进入详细评论页>>