Materialized Views Wizard (Oracle)

From RapidSQL
Jump to: navigation, search

Go Up to Oracle Object Wizards

A materialized view gives you indirect access to table data by storing a query’s results in a separate schema object. Essentially, a materialized view is a database object that contains the results of a query.

The Materialized View Wizard lets you:

  • Specify the materialized view owner and to name the materialized view.
  • Specify the materialized view's refresh configuration.
  • Place the materialized view on a tablespace and specify the query that should be used to populate the materialized view.
  • Specify how Oracle should allocate data blocks to store the materialized view.
  • Specify how Oracle should manage the growth of the materialized view.
  • Specify if Oracle updates the materialized view, register an existing table, and specify how to populate a materialized view.
  • Specify if the data for the materialized view is cached, if you want the updates logged, and to specify a number of threads for a parallel operation.
  • Specify rollback segments, and enable query rewrites.

To Open the Materialized View Wizard

  1. On the Navigator, find the datasource where you want to create a Materialized View and expand the Schema node.
  2. Right-click the Materialized Views node, and select New.

The table that follows describes the fields you may encounter as you complete the wizard:

Required Information Description

Who owns the materialized view?

Self-explanatory

What is the name of the materialized view?

Self-explanatory.

How should the materialized view be refreshed?

Fast - Using the information logged on the materialized view logs or a partition maintenance operation, the refresh applies incremental changes. See Fast Refresh Requirements for more information. Complete - This refresh recalculates the materialized view’s defining query. Force - Applies fast refresh when feasible, otherwise uses a complete refresh. Never - Materialized view will not be refreshed with the optional refresh mechanisms.

Choose a refresh mechanism

On Demand - This option requires that all refreshes be manually executed. On Commit - Select to refresh the materialized view whenever Oracle processes a transaction. Only select this option for materialized views on single table aggregates and materialized views containing joins. Automatically - Select to refresh the materialized view automatically. In the On this date: boxes select a time and date, and then select a refresh amount and a unit of time.

Where do you want to place the materialized view?

Select the tablespace where you want the materialized view placed.

What is the materialized view query?

Type the SQL query to be used to populate and to refresh the materialized view.

Select a refresh method

Primary Key - A primary key's values uniquely identify the rows in a table. Changes are propagated according to row changes as identified by the primary key value of the row. Only one primary key can be defined for each table.The primary key of the master table is the basis for this refresh option, which is the default option. ROWID - A globally unique identifier for a row in a database based on the physical row identifiers. A RowID is created at the time the row is inserted into a table, and destroyed when it is removed from a table. ROWID materialized views cannot contain distinct or aggregate functions or GROUP BY subqueries, joins and set operations.

How many transaction entries are allowed for each datablock in the materialized view?

A transaction is a logical unit of work that contains one or more SQL statements. Each transaction that updates a data block requires a transaction entry. Initial (1-255) - Ensures that a minimum number of concurrent transactions can update a data block, avoiding the overhead of allocating a transaction entry dynamically. Maximum (1-255) - Limits concurrency on a data block.

What is the percent of space reserved for future updates?

Percent Free (0 99) - This sets the percentage of a data block to be reserved for possible row updates that are included in the block. The value you set is the percent kept free.

What is the minimum percentage of used space that Oracle maintains for each datablock?

Percent Used (0-99) - Set the amount of space to be used for each datablock. NOTE: The sum of percent free and the percent used cannot exceed 100.

How large are the materialized views extents?

The unit of space allocated to an object whenever the object needs more space. An extent is a specific number of contiguous data blocks set aside for storing a specific type of information. Initial Extent (KB) - The initial space extent (in bytes) allocated to the object. Next Extent - The next extent (in bytes) that the object will attempt to allocate when more space for the object is required.

How many extents should be allocated to the materialized view?

Minimum Extents - The appropriate minimum extents value for the object. Maximum Extents - The appropriate maximum extents value for the object.

What is the growth rate for sizing additional materialized views?

Percent Increase - Magnifies how an object grows and can materially affect available free space in a tablespace. Select a value in the corresponding box.

Can the materialized view be updated?

Yes/No

Do you want to register a prebuilt table to the view?

Yes/No. This option is particularly useful for registering large materialized views in a data warehousing environment.

Should the materialized view be immediately filled?

Yes/No: Select Yes if you want the materialized view populated immediately or during the next refresh operation.

Should data for the materialized view be cached?

Yes/No: Select if you want Oracle to put data you access frequently at the most recently used end of the list in the buffer cache when a full table scan is performed. This option is useful for small lookup tables.

Do you want updates to be logged?

Yes/No.

Do you want to specify the number of threads used in a parallel operation?

Parallel processes means that multiple processes work simultaneously to run a single statement. This can cut the amount of time it takes to get a response. Specify the degree of parallelism if you so desire. If you leave the default at 1, the operation will not be “parallelized.”

Would you like to specify rollback segments to be used for the materialized view refresh?

A rollback segment temporarily stores old data that has changed in a SQL statement transaction until it is committed. The “before” image of the database, as it were. Local Rollback Segment - Default indicates that Oracle will select the rollback segment to use on the local machine. Master Rollback Segment - Specify the remote rollback segment used at the remote master site for the individual materialized view.

Is the materialized view eligible for query rewrite?

Select to enable the materialized view for query rewrite. Only enable query rewrite if expressions in the statement are repeatable.

Do you want to partition this materialized view?

Yes/No Partitioning methods available are: Range: Data is mapped to partitions based on ranges of column values. This is the default. Composite: Based on the range method of partitioning, you can create subpartitions within each partition. Hash: Data is distributed evenly over a specified number of partitions. Data need not fit into a logical range. List: You control explicitly how rows map to partitions. List partitions allow you to group and organize unrelated sets of data.

Do you want to enable Row Movement?

Yes/No Enabling row movement allows you to specify whether Oracle can move a table row when you are compressing a table or performing an update on partitioned data.

Select the partitioning columns

Self-explanatory

Select the subpartitioning method

Self-explanatory

Select the subpartitioning columns

Self-explanatory

Hash Partitioning methods

None Partition Definition: Specify number of partitions and (optionally) tablespaces Specify individual partitions by name and (optionally) tablespaces

Create list/ordered list of partitions

Self-explanatory The Add Partition dialog may open.

Specify number of subpartions

Self-explanatory Click Add, Insert, or Edit to open a dialog that lets you work with subpartition properties.

Select the default tablespaces to contain the subpartitions (optional)

Self-explanatory

Fast Refresh Requirements

When the Materialized View has:

Only Joins

Joins and Aggregates

Aggregate on a Single Table

Detail tables only

X

X

X

Single table only

X

Table Appears only once in the FROM list

X

X

X

No non-repeating expressions like SYSDATE and ROWNUM

X

X

X

No references to RAW or LONG RAW

X

X

X

No GROUP BY

X

Rowids of all the detail tables must appear in the SELECT list of the query

X

Expressions are allowed in the GROUP BY and SELECT clauses provided they are the same

X

X

Aggregates allowed but cannot be nested

X

X

AVG with COUNT

X

X

SUM with COUNT

X

Only Joins

Joins and Aggregates

Aggregate on a Single Table

VARIANCE with COUNT and SUM

X

X

STDDEV with COUNT and SUM

X

X

WHERE clause includes join predicates which can be ANDed bit not ORed.

X

X

No WHERE clause

X

No HAVING or CONNECT BY

X

X

X

No subqueries, inline views, or set functions like UNION or MINUS

X

X

X

COUNT(*) must be present

X

No MIN and MAX allowed

X

If outer joins, then unique constraints must exist on the join columns of the inner join table

X

Materialized View logs must exist and contain all columns referenced in the materialized view and have been created with the LOG NEW VALUES clause

X

Materialized View Logs must exist with rowids of all the detail tables

X

Non-aggregate expression in SELECT and GROUP BY must be straight columns

X

DML to detail table

X

X

Direct path data load

X

X

X

ON COMMIT

X

X

ON DEMAND

X

X

X


Personal tools