The following restrictions apply when creating, initializing, refreshing, and view matching materialized views:
When creating a materialized view, the definition for the materialized view must define column names explicitly; you cannot
SELECT * construct as part of the column definition.
When creating a materialized view, the definition for the materialized view cannot contain:
references to other views, materialized or not
references to remote or temporary tables
variables such as CURRENT USER; all expressions must be deterministic
calls to stored procedures, user-defined functions, or external functions
T-SQL outer joins
FOR XML clauses
The following database options must have the specified settings when a materialized view is created; otherwise, an error is returned. These database option values are also required for the view to be used by the optimizer:
The following database option settings are stored for each materialized view when it is created. The current option values for the connection must match the values stored for a materialized view in order for the view to be used in optimization:
When a view is refreshed, the connection settings for all the options listed in the bullets above are ignored. Instead, the database option settings (which must match the stored settings for the view) are used.
Materialized views are similar to base tables in that the rows are not stored in any particular order; the database server orders the rows in the most efficient manner when computing the data. Therefore, specifying an ORDER BY clause in a materialized view definition has no guaranteed impact on the ordering of rows when the view is materialized. Also, the ORDER BY clause in the view's definition is ignored by the optimizer when performing view matching.
For information about materialized views and view matching by the optimizer, see Improving performance with materialized views.
The following restrictions are checked when changing a manual view to an immediate view. An error is returned if the view violates any of the restrictions:
You can use the sa_materialized_view_can_be_immediate system procedure to find out if a manual view is eligible to become an immediate view. See sa_materialized_view_can_be_immediate system procedure.
The view must be uninitialized. See Materialized view statuses and properties.
The view must have a unique index on non-nullable columns. If it does not, you must add one. See Create indexes.
If the view definition is a grouped query, the unique index columns must correspond to select list items that are not aggregate functions.
The view definition cannot contain:
The view definition must be a single select-project-join or grouped-select-project-join query block, and the grouped-select-project-join query block cannot contain a HAVING clause.
The grouped-select-project-join query block must contain COUNT(*) in the select list, and is allowed only the SUM and COUNT aggregate functions.
For a description of these structures, see Materialized view evaluation.
An aggregate function in the select list cannot be referenced in a complex expression. For example,
SUM(expression) + 1 is not allowed in the select list.
|Envoyer votre avis sur cette page par email.||Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|