mviews.rst 1.4 KB

1234567891011121314151617181920212223
  1. Materialized Views
  2. ==================
  3. .. note::
  4. Remember you must set the ``$DRUPAL_HOME`` environment variable if you want to cut-and-paste the commands below. See :doc:`../prereqs/drupal_home`
  5. Chado is efficient as a data warehouse but queries can become slow depending on the type of query. To help simplify and speed up these queries, materialized views can be employed. For a materialized view, a new database table is created and then populated with the results of a pre-defined SQL query. This allows you to execute a much simpler and faster query on the materialized view when producing user pages. A side effect, however is redundant data, with the materialized view becoming stale if not updated regularly.
  6. Tripal provides a mechanism for populating and updating these materialized views. These can be found on the **Tripal → Data Storage → Chado -> Materialized Views** page.
  7. .. image:: ./mviews/mviews.1.png
  8. Here we see several materialized views. These were installed automatically by the Tripal Chado module. To update these views, click the **Populate** link for each one.
  9. This will submit jobs to populate the views with data. Now, run the jobs:
  10. .. code-block:: shell
  11. cd $DRUPAL_HOME
  12. drush trp-run-jobs --user=administrator
  13. You can now see that all views are up-to-date on the **Materialized Views Page**. The number of rows in the view table is shown.