Regular views have a status associated with them. The status reflects the availability of the view for use by the database server. You can view the status of all views by clicking Views in the left pane of Sybase Central, and examining the values in the Status column in the right pane. Or, to see the status of a single view, right-click the view in Sybase Central and click Properties to examine the Status value.
Following are descriptions of the possible statuses for regular views:
VALID The view is valid and is guaranteed to be consistent with its definition. The database server can make use of this view without any additional work. An enabled view has the status VALID.
In the SYSOBJECT system view, the value 1 indicates a status of VALID.
INVALID An INVALID status occurs after a schema change to a referenced object where the change results in an unsuccessful attempt to enable the view. For example, suppose a view, v1, references a column, c1, in table t. If you alter t to remove c1, the status of v1 is set to INVALID when the database server tries to recompile the view as part of the ALTER operation that drops the column. In this case, v1 can recompile only after c1 is added back to t, or v1 is changed to no longer refer to c1. Views can also become INVALID if a table or view that they reference is dropped.
An INVALID view is different from a DISABLED view in that each time an INVALID view is referenced, for example by a query, the database server tries to recompile the view. If the compilation succeeds, the query proceeds. The view's status remains INVALID until it is explicitly enabled. If the compilation fails, an error is returned.
When the database server internally enables an INVALID view, it issues a performance warning.
In the SYSOBJECT system view, the value 2 indicates a status of INVALID.
DISABLED Disabled views are not available for use by the database server for answering queries. Any query that attempts to use a disabled view returns an error.
A regular view has this state if:
you explicitly disable the view, for example by executing an ALTER VIEW...DISABLE statement.
you disable a view (materialized or not) upon which the view depends.
you disable view dependencies for a table, for example by executing an ALTER TABLE...DISABLE VIEW DEPENDENCIES statement.
In the SYSOBJECT system view, the value 4 indicates a status of DISABLED.
Discuss this page in DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|