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

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with views » Working with materialized views

Initializing materialized views Next Page

Refreshing materialized views

Data in a materialized view becomes stale when the data changes in the tables referenced by the materialized view. You should consider the acceptable degree of data staleness for the materialized view, and automate a refresh strategy accordingly. In your strategy, you should factor the time it takes to refresh the view, since it is not available for querying during the refresh process. Once you have decided how often to refresh the view, you can create a scheduled event that refreshes the view.

Upgrading databases with materialized views

It is recommended that you refresh the materialized views in your database after upgrading your database server, or after rebuilding or upgrading your database to work with an upgraded database server.

The isolation level for the connection is used when refreshing the data in the materialized view.

You can also configure a staleness threshold beyond which the optimizer should not use a materialized view when processing queries, using the materialized_view_optimization database option. See Setting the optimizer staleness threshold for materialized views.

Before creating, initializing, or refreshing materialized views, ensure that all materialized view restrictions have been met. See Restrictions when managing materialized views.

To refresh a materialized view (Sybase Central)
  1. Connect to the database as the DBA, or with INSERT permission on the materialized view.

  2. Open the Views folder for that database.

  3. Select the materialized view and choose File > Refresh Data.

To refresh a materialized view (SQL)
  1. Connect to the database as the DBA, or with INSERT permission on the materialized view.

  2. Execute a REFRESH MATERIALIZED VIEW statement.

  3. Example

    The following statement refreshes the EmployeeConfidential materialized view.

    REFRESH MATERIALIZED VIEW EmployeeConfidential;
    See also