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

 

Enabling or disabling a materialized view

You can control whether a materialized view is available for querying by enabling and disabling it.

Prerequisites

You must be the owner of the materialized view or have one of the following system privileges:

  • ALTER ANY MATERIALIZED VIEW
  • ALTER ANY OBJECT

To enable a materialized view, you must also have the SELECT privilege on the underlying table(s) or the SELECT ANY TABLE system privilege.

 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.

    Option Action
    Enable a materialized view
    1. Right-click the view and click Recompile And Enable.

    2. (optional) Right-click the view and click Refresh Data to populate the view with data. This step is optional because the first query that is run against the views after enabling it would also cause the view to be populated with data.

    Disable a materialized view Right-click the view and click Disable.

Results

When you enable a materialized view, it becomes available for use by the database server and you can query it.

When you disable a materialized view, the data and indexes are dropped. If the view was an immediate view, it is changed to a manual view. Querying a disabled materialized view fails and returns and error.

Next

After you re-enable a view, you must rebuild any indexes for it, and change it back to an immediate view if it was an immediate view when it was disabled.

 See also