简体   繁体   English

MySQL的物化视图

[英]Materialized views with MySQL

Emulated materialized views with MySQL has good performance? 用MySQL模拟物化视图是否具有良好的性能? I'm learning how to do with this link 我正在学习如何使用此链接

thanks 谢谢


Correction: "Materialized views" to "Emulated materialized views". 更正:从 “实体化视图”到“模拟的实体化视图”。

A materialized view is just a fancy name for a normal table with the data from some heavy query. 物化视图只是普通表的奇特名称,它包含来自大量查询的数据。

So although creating it is just as heavy as the heavy query itself, querying it is really fast. 因此,尽管创建它与繁重的查询本身一样繁重,但查询确实非常快。

The big question here is how you want to update the view. 这里最大的问题是如何更新视图。

  • You can do a regular full refresh. 您可以进行定期的完整刷新。 Simple to do, but heavy during that update and in between updates the data is outdated. 操作简单,但是在该更新期间以及两次更新之间的数据过时。
  • You can use triggers to automatically update the data when inserting/deleting/updating. 插入/删除/更新时,可以使用触发器自动更新数据。 That makes the inserts/deletes/updates for your other tables slightly heavier, but it won't be outdated. 这会使其他表的插入/删除/更新略重,但不会过时。

MySQL doesn't have materialized views - the link just creates a table and stuffs data into it so the table can be indexed. MySQL没有实例化视图-链接仅创建一个表并将数据填充到其中,以便可以对表建立索引。 That means the performance is par with a normal table, but you also have the overhead of flushing & repopulating the table (including indexes). 这意味着性能与普通表相当,但是您还具有刷新和重新填充表(包括索引)的开销。

I didn't see what engine the table was using, but MEMORY would likely be a better choice. 我没有看到该表使用的是什么引擎,但是MEMORY可能是一个更好的选择。

Flexviews (http://flexvie.ws) is an open source PHP/MySQL based project. Flexviews(http://flexvie.ws)是一个基于PHP / MySQL的开源项目。 Flexviews adds incrementally refreshable materialized views (like the materialized views in Oracle) to MySQL, usng PHP and stored procedures. Flexviews将增量可刷新的实例化视图(如Oracle中的实例化视图)添加到MySQL,使用PHP和存储过程。

It includes FlexCDC, a PHP based change data capture utility which reads binary logs, and the Flexviews MySQL stored procedures which are used to define and maintain the views. 它包括FlexCDC(一种基于PHP的更改数据捕获实用程序,可读取二进制日志)以及Flexviews MySQL存储过程,这些存储过程用于定义和维护视图。

Flexviews supports joins (inner join only) and aggregation so it can be used to create summary tables. Flexviews支持联接(仅内部联接)和聚合,因此可用于创建汇总表。 Moreover, you can use Flexviews in combination with Mondrian's (a ROLAP server) aggregation designer to create summary tables that the ROLAP tool can automatically use. 此外,您可以将Flexviews与Mondrian(ROLAP服务器)的聚合设计器结合使用,以创建汇总表,ROLAP工具可以自动使用该汇总表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM