Automatic View Update in MySql(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 中的自动视图更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySql 中的自动视图更新
基础教程推荐
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
