在 MySQL 中创建物化视图时出现语法错误

发布于 2024-12-16 19:09:46 字数 361 浏览 1 评论 0原文

在 MySQL 中创建物化视图时出现语法错误:

尝试创建 mview,如下所示:

 create materialized view test.dept10
 as
 select * from test.employees
 where deptno=10;

**ERROR 1064 (42000):** You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'materialized view test.dept10

Syntax error while creating materialized view in MySQL:

Tried to create the mview as below:

 create materialized view test.dept10
 as
 select * from test.employees
 where deptno=10;

**ERROR 1064 (42000):** You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'materialized view test.dept10

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

咆哮 2024-12-23 19:09:46

开箱即用的 MySQL 不支持物化视图。

Out-of-the box MySQL doesn't do materialized views.

好听的两个字的网名 2024-12-23 19:09:46

您收到此错误是因为 MySQL 没有物化视图。
阅读这篇文章,我为其发布了第一部分:

物化视图(MV)是预先计算(物化)的结果
的一个查询。与简单的 VIEW 不同,物化视图的结果是
存储在某处,通常在表中。使用物化视图
当需要立即响应并且查询物化时
查看基础需要很长时间才能产生结果。物化
视图必须偶尔刷新一次。这取决于
要求物化视图刷新的频率以及实际的刷新频率
其内容是。基本上物化视图是可以刷新的
立即或延迟,可以完全刷新或刷新到一定程度
时间点。 MySQL 本身不提供物化视图。
但自己构建物化视图很容易。

MySql 页面中,您可以找到有关如何实现的其他示例你的目标。

You get this error because MySQL does not have materialized views.
Read this article for which I post the first part:

A Materialized View (MV) is the pre-calculated (materialized) result
of a query. Unlike a simple VIEW the result of a Materialized View is
stored somewhere, generally in a table. Materialized Views are used
when immediate response is needed and the query where the Materialized
View bases on would take to long to produce a result. Materialized
Views have to be refreshed once in a while. It depends on the
requirements how often a Materialized View is refreshed and how actual
its content is. Basically a Materialized View can be refreshed
immediately or deferred, it can be refreshed fully or to a certain
point in time. MySQL does not provide Materialized Views by itself.
But it is easy to build Materialized Views yourself.

In MySql page you can find other examples on how achieve your goal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文