Developer preview of Materialized Views
I’ve posted a developer preview of Materialized Views for Drupal 6. I’d like ambitious Drupal developers to try it out so I can get feedback on the developer experience.
From sites/all/modules:
bzr branch bzr://vcs.fourkitchens.com/drupal/modules/materialized_view/6 materialized_view (all on one line)
To get them running:
- Install all three MV-related modules.
- Run cron.
This will create the mv_forum_topic materialized view, which is populated and indexed for fast Forum module topic listings.
Specific developer experience areas I’d like feedback on:
- Creating new materialized views.
- Creating new data sources.
If you create or modify MVs, run cron to generate the tables and index the data.













Comments
You might want to mention just what Materialized Views actually does…
So is this the evolution of the DNA module from Drupal 5? And more importantly, does this actually provide Views integration?
I have a site where I’m using one materialized view table entirely by hand with Views integration, and it was a huge speed boost. I’m in the process of porting it to D6, and wondering how I’m going to deal with that. I’d prefer a standardized solution if possible.
Oh, and for those of us who don’t have bzr, how do we get this magical code? :-)
Yes, this is the evolution of DNA (no pun intended). Like DNA, MV indexes and updates your materialized tables.
Unlike DNA, MV supports indexing anything (not just nodes), flexible data sources that map well to CCK and Field API, automatic generation of the correct table schema and indexes, and having a many-to-one (instead of one-to-one) relationship between the materialized rows and the objects being indexed.
MV is sort of begging for someone to write a module that exposes Views as MVs, but I’m not familiar enough with Views 2 internals to handle that just yet.
I’ll post a tarball for non-Bazaar users.
Awesome! Thanks
I’ll definitely try this when I find the time. And a tarball would indeed be much appreciated :)
Here’s a tarball: http://straussd.fourkitchens.com/materialized_view-preview.tar.gz
I’ve updated the tarball with the version currently in trial deployment on Drupal.org.
Hi David,
I am previewing your module with the intention of using it with apache solr to increase the speed on indexing. All is going well but I was having trouble populating my mv view tables looking through the code I found what I think is a bug. When pulling data from the MVEntityCache::get method it returns nothing.
self::$entities[$entity_type][$entity_id] = $load_function($entity_id);
return $entities[$entity_type][$entity_id];
should be
self::$entities[$entity_type][$entity_id] = $load_function($entity_id);
return self::$entities[$entity_type][$entity_id];
Great module and I will post my results on the indexing speedup.
Regards
David
Sorry I forgot to mention I got the source from the bzr branch checkout