在工作中,我经常被告知,当对 MySQL 数据库进行更改时,需要“刷新” View 。公认的手动解决方案似乎是进入 Workbench,右键单击,然后点击“全部刷新”
这只是为了清除缓存吗?还是从头开始重建 View ,或者这完全是假的?他们似乎能够判断什么时候 View 没有被“刷新”,我不确定他们是否理解,“因为当它们改变时需要刷新。”
如果只是清除缓存,'FLUSH TABLES WITH READ LOCK' 就足够了吗?
最佳答案
数据 更改时不需要刷新 View 。当您查询它们时,它们将获取最新数据。
如果您的表结构发生变化,可能需要重新创建它们:
The view definition is “frozen” at creation time, so changes to the underlying tables afterward do not affect the view definition. For example, if a view is defined as SELECT * on a table, new columns added to the table later do not become part of the view.
关于mysql - 刷新 MySQL View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3419915/