Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Tables, views, and indexes » Materialized views

 

Advanced: Changing the refresh type for a materialized view

When you create a materialized view, its refresh type is manual, but you can change it to immediate. You can also change an immediate view back to manual again.

Prérequis

You must be the owner, or have both the CREATE ANY MATERIALIZED VIEW and DROP ANY MATERIALIZED VIEW system privileges, or both the CREATE ANY OBJECT and DROP ANY OBJECT system privileges. If you do not have a required privilege but want to alter a materialized view to be immediate (ALTER MATERIALIZED VIEW...IMMEDIATE REFRESH), you must own the view and all the tables it references.

To change from manual to immediate, the view must be in an uninitialized state (contain no data). If the view was just created and has not yet been refreshed, it is uninitialized. If the materialized view has data in it, you must execute a TRUNCATE statement on it to return it to an uninitialized state before you can change it to immediate. The materialized view must also have a unique index, and must conform to the restrictions required for an immediate view.

An immediate view can be changed to manual at any time without any additional steps other than changing its refresh type.

 Task
  1. In Sybase Central, use the SQL Anywhere 16 plug-in to connect to the database.

  2. In the left pane, double-click Views.

  3. Right-click the materialized view and click Properties.

  4. In the Refresh Type field, choose one of the following options:

    Option Action
    Change a manual view to an immediate view Immediate
    Change an immediate view to a manual view Manual
  5. Click OK.

Résultat

The refresh type of the materialized view is changed. Immediate views are updated whenever there are changes to the data in the underlying objects. Manual views are updated whenever you refresh them.

Suivant

After you change a view from manual to immediate, the view must be initialized (refreshed) to populate it with data.

 See also