MySql中的自动视图更新 [英] Automatic View Update in MySql

查看:691
本文介绍了MySql中的自动视图更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中更新基础表而无需查询时,视图是否会自动更新?

Does the view get automatically updated when the underlying tables get updated in MySQL without querying?

进一步详细说明-如果我更新表,那么即使我没有在视图上运行任何查询,该视图也会更新吗?

To further elaborate - if I update the table then does the view get updated even if I don't run any query on the view?

推荐答案

每次在视图上执行查询时,它都会获取表中当前的数据-包括表上所有已提交的事务,但不包括那些UPDATE或INSERT查询仍未落实.

Every time you execute a query on the view, it will fetch the data currently in tables - included all committed transactions on it, but not those UPDATE or INSERT queries taht have still not been committed.

但是,当然,一旦获得了这些数据,它就不会再次发送它.有一些触发条件,但是您的数据库客户端仍然必须查询视图数据.

but of course, once you have got that data, it will not send it again. There are triggers for that, but still your database client has to query the view data out.

要多清理一点:视图不存储(缓存)数据,它是一种逻辑结构,将始终查看基础表.

To clear up a bit more: View does not store (cache) the data, it is a logical structure and will always look into the underlying tables.

这篇关于MySql中的自动视图更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆