title: Update materialized view when urderlying tables change
body: <p>I have a materialized view defined this way:</p>
  
  <pre><code>CREATE MATERIALIZED VIEW M_FOO
  REFRESH COMPLETE ON COMMIT
  AS
      SELECT FOO_ID, BAR
      FROM FOO
      WHERE BAR IS NOT NULL
      GROUP BY FOO_ID, BAR
  /
  
  COMMENT ON MATERIALIZED VIEW M_FOO IS 'Foo-Bar pairs';
  </code></pre>
  
  <p>I wrote as a sort of cache: the source table is huge but the number of different pairs is fairly small. I need those pairs to get them JOINed with other tables. So far so good: it absolutely speeds queries.</p>
  
  <p>But I want to make sure that the view does not contain obsolete data. The underlying table is modified four or five times per month but I don't necessarily know when. I understand that a materialized view can be defined so it updates when the source tables change. However, the docs get pretty complicate.</p>
  
  <ol>
  <li><p>What's the exact syntax I need to
  use?</p></li>
  <li><p>Do I need to create a materialized
  view log?</p></li>
  <li><p>What's the difference between fast
  and complete refresh?</p></li>
  </ol>