<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <pre class="tw-data-text tw-text-large tw-ta" data-placeholder="Traduction" id="tw-target-text" style="text-align:left" dir="ltr"><span lang="en">Hello,

I need to refresh a materialized view in my database, but I only want to do it when necessary.

I use the materialized view because the view costs more than 20 seconds. It's a big table.

If I refresh with trigger on the table that is used, after each update, I wait 20s ...

I have considered several solutions but I can't seem to put them in place. They may not be possible ... Is there one you know?

I thought of :
- Put a trigger on the tables used by the materialized view: Slow
- delay updating the view materialized with notify / listen but I didn't understand how it works and send a request when the listen receives the notification.
- Search for an asynchronous update of the materialized view: without success
- Create a view of the materialized view to add a rule on select: without success
- Create a view of the materialized view with in the call to the function that checks if the view is up to date (using a third-party table): error cannot execute REFRESH MATERIALIZED VIEW because this object is being use by
active requests in this session

Do you have any idea to do this ?

Thanks
</span></pre>
    <div class="moz-signature">-- <br>
      <table width="450" height="100" cellspacing="0" cellpadding="0"
        border="0">
        <tbody>
          <tr valign="bottom">
            <td colspan="2">
              <hr size="3" noshade="noshade" color="#CCCCCC"> </td>
            <td>
              <br>
            </td>
          </tr>
          <tr>
            <td>
              <a href="http://www.ledepartement.fr" hreflang="fr">
                <img
src="http://www.ledepartement.fr/fileadmin/integration/lib/images/logo-cd82-footer.png
                  " alt="Logo CD82" width="150" border="0" align="left">
              </a> </td>
            <td>
              <font size="3" face="Eras Medium ITC">
                Guillaume ARNAUD
              </font><br>
              <font size="2" face="Eras Medium ITC">
                Technicien SIG
              </font><br>
              <font medium="" itc»="" size="»2»" face="»Eras">
                Cellule SIGD
              </font><br>
              <font medium="" itc»="" size="»2»" face="»Eras">
                Direction des systèmes informatiques et de
                télécommunication
              </font><br>
              <font medium="" itc»="" size="»2»" face="»Eras">
                Pôle coordination et ressources
              </font><br>
              <font size="2" face="Eras Medium ITC">Tél : 05 63 91 82 37
              </font><br>
              <a class="moz-txt-link-freetext" href="mailto:
                guillaume.arnaud@ledepartement82.fr
                "><font size="2">
                  guillaume.arnaud@ledepartement82.fr
                  <!--
font--></font></a><font size="2">
              </font></td>
          </tr>
          <tr valign="top">
            <td colspan="2">
              <hr size="3" noshade="noshade" color="#CCCCCC">
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>