Which views are read only
Replication is the process of copying and maintaining database objects, such as tables, in multiple databases that comprise a distributed database system. One method that supports replication is read-only materialized views.
Replication environments support two basic types of databases: master databases and materialized view databases. Materialized view databases contain an image, or materialized view, of the table data from a certain point in time. The table on which a materialized view is defined is the master table for the materialized view. Typically, a materialized view is refreshed periodically to synchronize it with its master table.
You can organize materialized views into refresh groups. Materialized views in a refresh group are refreshed at the same time to ensure that the data in all materialized views in the refresh group correspond to the same transactionally consistent point in time.
A read-only materialized view contains a complete or partial copy of a target master table from a single point in time. A partial copy can include a subset of row, a subset of columns, or both. Read-only materialized views can provide read-only access to the master table's data.
Applications can query data from read-only materialized views to avoid network access to the master database, regardless of network availability. However, applications throughout the system must access data at the master database to perform data manipulation language changes DML. Figure illustrates basic, read-only replication. When the materialized view is in a different database than its source, offload queries from the master database, because users can query the local materialized view instead.
Increase data security by enabling you to replicate only a selected subset of the target master's data set. Users can synchronize refresh read-only materialized views on demand.
When users refresh read-only materialized views, they receive any changes that happened on the master table since the last refresh. You can use materialized views to achieve goals such as easing network loads, enabling data subsetting, and enabling disconnected computing. If one of your goals is to reduce network loads, then you can use materialized views to distribute your corporate database to regional databases. Instead of the entire company accessing a single database server, user load is distributed across multiple database servers.
To decrease the amount of data that is replicated, a materialized view can be a subset of a master table. Parent topic: The Uses of Materialized Views. Data subsetting enables you to replicate information that pertains only to a particular database.
For example, if you have a regional sales office, then you might replicate only the data that is needed in that region, thereby cutting down on unnecessary network traffic. Both row and column subsetting enable you to create materialized views that contain a partial copy of the data at a master table. Row subsetting enables you to include only the rows that are needed from the masters in the materialized views by using a WHERE clause.
Column subsetting enables you to include only the columns that are needed from the masters in the materialized views. Though you have the option of automating the refresh process by scheduling a job, you can manually refresh your materialized view on-demand, which is an ideal solution for queries running on a laptop computer. Available materialized views include primary key materialized views, object materialized views, ROWID materialized views, and complex materialized views.
Oracle offers several types of read-only materialized views to meet the needs of many different replication and nonreplication situations. Whenever you create a materialized view, regardless of its type, always specify the schema name of the table owner in the query for the materialized view.
Parent topic: Available Materialized Views. Because primary key materialized views are the default, the following statement also results in a primary key materialized view:. Primary key materialized views can contain a subquery so that you can create a subset of rows at the remote materialized view database.
Primary key materialized views that contain a selected class of subqueries can still be incrementally or fast refreshed, if each master referenced has a materialized view log. A fast refresh uses materialized view logs to update only the rows that have changed since the last refresh. To create this oe. If a materialized view is based on an object table and is created using the OF type clause, then the materialized view is called an object materialized view. An object materialized view is structured in the same way as an object table.
That is, an object materialized view is composed of row objects, and each row object is identified by an object identifier OID column. A ROWID materialized view is based on the physical row identifiers rowids of the rows in a master table.
ROWID materialized views can be used for materialized views based on master tables that do not have a primary key, or for materialized views that do not include all primary key columns of the master tables. To be fast refreshed, the defining query for a materialized view must observe certain restrictions. If you require a materialized view whose defining query is more general and cannot observe the restrictions, then the materialized view is complex and cannot be fast refreshed.
Specifically, a materialized view is considered complex when the defining query of the materialized view contains any of the following:. In some cases, an aggregate function, although it is possible to have an aggregate function in the defining query and still have a simple materialized view. In some cases, joins other than those in a subquery, although it is possible to have joins in the defining query and still have a simple materialized view. Specifically, a materialized view with a UNION operation is complex if any one of these conditions is true:.
The previous bullet items specify when a query makes a materialized view complex. Therefore, the materialized view is complex. Clauses that do not follow the requirements detailed in " Restrictions for Materialized Views with Subqueries ". If possible, you should avoid using complex materialized views because they cannot be fast refreshed, which might degrade performance. Oracle Database Data Warehousing Guide for information about materialized views with aggregate functions and joins.
Parent topic: Complex Materialized Views. Figure and the following text discuss some issues that you should consider. The materialized view in Database II exhibits efficient query performance because the join operation was completed during the materialized view's refresh.
However, complete refreshes must be performed because the materialized view is complex, and these refreshes will probably be slower than fast refreshes. Simple Materialized Views with a Joined View : Method B in Figure shows two simple materialized views in Database II, as well as a view that performs the join in the materialized view's database.
Query performance against the view would not be as good as the query performance against the complex materialized view in Method A.
However, the simple materialized views can be refreshed more efficiently using fast refresh and materialized view logs. If you refresh rarely and want faster query performance, then use Method A complex materialized view. If you refresh regularly and can sacrifice query performance, then use Method B simple materialized view. The users related to materialized views include the creator, the refresher, and the owner. The privileges required to perform operations on materialized views depend on the type of user performing the operation.
Owner: The user who owns the materialized view. The materialized view resides in this user's schema. One user can perform all of these operations on a particular materialized view. However, in some replication environments, different users perform these operations on a particular materialized view.
The privileges required to perform these operations depend on whether the same user performs them or different users perform them. If the owner of a materialized view at the materialized view database has a private database link to the master database, then the database link connects to the owner of the master table at the master database.
Otherwise, the normal rules for connections through database links apply. The following sections do not cover the requirements necessary to create materialized views with query rewrite enabled.
With care and skill, it is thus possible to use views to pre-empt the normal trigger behavior of the base table under planned circumstances. Firebird Interview Questions. All Practice Tests. IT Skills. Management Skills. Communication Skills. Business Skills. Digital Marketing Skills. Human Resources Skills. Health Care Skills. Finance Skills. All Courses. Firebird Tutorial. You cannot use the same name for a table and a view in the same schema.
The default is to not give all users access to the view. Note that in the View Text area you must replace host variable references question marks with actual values before saving the view text.
An SQL view name is used to generate a corresponding unique class name , following name translation rules. Refer to Catalog Details for a View. A view is considered updateable only if the following conditions are true:. This table reference must identify either an updateable base table or an updateable view.
This clause can only be used with updateable views. All constraints are checked, triggers pulled, and so on. Any view that does not meet the criteria for updateable views is a read-only view. Like table row ID numbers, these view row ID numbers are system-assigned, unique, non-null, non-zero, and non-modifiable. TOP optimizes to return the first row of data as quickly as possible.
The following example uses this strategy to return the same results as the previous view query:. VIEWS persistent class displays information about all views in the current namespace. It provides a number of properties including the view definition, the owner of the view, and the timestamps when the view was created and last modified. These properties also include whether the view is updateable and if so, whether it was defined with a check option.
This directive is not required for Dynamic SQL. For example,. When issued from the Management Portal SQL Execute Query interface, returns a string with a space between the view fields list with whitespace and line breaks removed and if necessary an appended ellipsis The following example returns all information for all non-system views in the current namespace:.
The Catalog Details View Info display also provides an option to edit the view definition. This is shown in the following example:. You specify schema. If you specify only viewname , it uses the system-wide default schema name. The caller must have privileges for the specified view to execute this class query. This SQLViewDependsOn query lists the tables that the view depends upon, listing the table schema followed by the table name.
This allows a caller without table privileges to determine how many tables the view depends upon, but not the names of the tables.
Release Information. Release Notes. Supported Platforms. InterSystems Kubernetes Operator. Using the InterSystems Kubernetes Operator. Installation Kit.
Installation Basics Installation Guide. Automating Configuration Configuration Parameters. Data Migration. System Administration. Monitoring Guide. Error Reference. Specialized System Tools and Utilities. Mirroring and High Availability. First Looks. Scalability Guide. Note: Read-only views can be updated by using a combination of user-defined referential constraints, triggers, and unique indexes.
For information on how to update read-only views using triggers, see Working with Triggers. Category : Data Definition Guide.
0コメント