HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlModerate

Best way to create a materialized view in MySQL

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
creatematerializedwayviewmysqlbest

Problem

I am using MySQL 5.6. I am not being able to a create materialized view like I can in Oracle. I have seen one or two solutions like Flexview.

Can anybody tell me best way to create a materialized view in MySQL (auto refresh like in Oracle ) with the minimum of complexity?

Solution

Materialized Views Do Not Exist in MySQL.

Flexviews has been recommended in the DBA StackExchange before

  • Bill Karwin's post : Does MySQL have a version of Change Data Capture?



  • Redguy's post : Need some support on MySQL Query



Since you have it already, some due diligence and elbow grease on your part may be necessary to get going on using it (if you haven't already done so)
ALTERNATIVE #1

You might look into setting up Summary Tables. You are going to need to index your base tables in order to support aggregation before building Summary Tables.
ALTERNATIVE #2

Here is an old post from http://www.materialized.info/ which has a more down-to-earth strategy that looks intriguing. It involves using triggers. Looks like it could be fun ...
ALTERNATIVE #3

If your base tables are not that big and you can live with querying entire tables once a week, try the User Comments section of the MySQL Documentation on CREATE VIEW for ideas. Search for word materialized on that page.

Context

StackExchange Database Administrators Q#86790, answer score: 16

Revisions (0)

No revisions yet.