• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

temptable类型的视图有关问题

mysql 搞代码 7年前 (2018-06-05) 134次浏览 已收录 0个评论

temptable类型的视图问题
merge类型的视图会将查询视图时使用的where条件与定义视图时的where条件相结合,然后从基表中取数据;
temptable类型的是将视图中的数据保存到一个临时表中。
我做了一个测试,就是向基表中插入数据,对于merge类型的视图,查询出新插入的数据很正常,因为本来就是对基表进行查询,可是对于temptable类型的视图,也能查询出新插入的数据!这块没太理解,临时表应该不会有新插入的数据吧?

——解决方案——————–
请给出基表和temptable的结构
——解决方案——————–

引用

For UNDEFINED, mysql chooses which algorithm to use. It prefers MERGE over TEMPTABLE if possible, because MERGE is usually more efficient and because a view cannot be updatable if a temporary table is used.

A reason to choose TEMPTABLE explicitly is that locks can be released on underlying tables after the temporary table has been created and before it is used to finish processing the statement. This might result in quicker lock release than the MERGE algorithm so that other clients that use the view are not blocked as long.


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:temptable类型的视图有关问题
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址