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 中的自动视图更新
基础教程推荐
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 无法解决整理冲突 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
