Materialized views that are manually refreshed become stale when changes occur to their underlying base tables. The optimizer will not consider a materialized view as a candidate for satisfying a query if the data has exceeded the staleness threshold configured for the view. Refreshing a manual view means that the database server re-executes the query definition for the view and replaces the view data with the new result set of the query. Refreshing makes the view data consistent with the underlying data. You should consider the acceptable degree of data staleness for the manual view and devise a refresh strategy. Your strategy should allow for the time it takes to complete a refresh, since the view is not available for querying during the refresh operation.
You can also set up a strategy in which the view is refreshed using events. For example, you can create an event to refresh at some regular interval.
Immediate materialized views do not need to be refreshed unless they are uninitialized (contain no data), for example after being truncated.
You can configure a staleness threshold beyond which the optimizer should not use a materialized view when processing queries, by using the materialized_view_optimization database option.
It is recommended that you refresh materialized views after upgrading your database server, or after rebuilding or upgrading your database to work with an upgraded database server.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|