EmpaticoOrg / scenic-mysql_adapter

MySQL adapter for thoughtbot/scenic
MIT License
30 stars 15 forks source link

Materialized Views #8

Open Victorcorcos opened 5 years ago

Victorcorcos commented 5 years ago

Hello guys

Do you have plans on creating Materialized Views for this MySQL gem? Maybe using an approach to deal with it? Since the MySQL doesn't have it naturally

Thanks

cainlevy commented 5 years ago

We could probably get close! MySQL supports CREATE TABLE ... SELECT. We could do refreshes with TRUNCATE; INSERT INTO ... SELECT and updates with maybe handle updates by creating a new table and swapping it for the old one (to minimize the time when the table is gone).

The trick would be allowing a dev to define one single SELECT definition that can be used for all strategies.