【发布时间】:2018-02-05 14:54:54
【问题描述】:
假设我写了一个类似"INSERT INTO my_table (a,b) VALUES (1,2)" 的查询。
从客户端传递查询到它保存在磁盘上,MySQL 内部发生了什么。
喜欢:
-> What all innodb objects(filesystem buffers/logs) affected?
-> What're the step the data has to pass through till it reaches on table space?
换句话说,数据库写入的解剖。
例如:
-> query being parsed by the parser
-> correct data page be loaded to innodb_buffer_pool
-> data being changed(dirty pages), and changes are logged to redo log buffer
-> entry on undo logs(rollback segment)
-> on commit, redo log buffer flushed to redo logfile
-> binary logging happens(if enabled)
-> dirty pages write to double write buffer
-> Finally it flushed to disk.
我相信人们有更好的方法/答案来解释这个序列。
【问题讨论】:
-
Hint.. 在 INSERT 查询上使用查询分析 (dev.mysql.com/doc/refman/5.5/en/show-profile.html) FULL.. 你可以看到查询在哪里执行 MySQL 源代码.. 使用 MySQL 源代码看看会发生什么...
标签: mysql sql sql-insert