Monitor Tables With Materialized Views and XLA

In most database systems, materialized views are used to simplify and enhance the performance of SELECT queries that involve multiple tables. Though materialized views offer this same capability in TimesTen, another purpose of materialized views in TimesTen Classic is their role in working with XLA to keep track of specific rows and columns in multiple tables.

Note:

See Understanding Materialized Views in Oracle TimesTen In-Memory Database Operations Guide. Also, see the CREATE MATERIALIZED VIEW statement in Oracle TimesTen In-Memory Database SQL Reference.

When a materialized view is present, an XLA application needs to monitor only update records that are of interest from a single materialized view. Without a materialized view, the XLA application would have to monitor all of the update records from all the detail tables of that materialized view, including records reflecting updates to rows and columns of no interest to the application.

Figure 8-2 shows an update made to a column in a detail table that is part of the materialized view result set. The XLA application monitoring updates to the materialized view captures the updated record. Updates to columns and rows in the same detail table that are not part of the materialized view are not seen by the XLA application.

Figure 8-2 Using XLA to Detect Updates on a Materialized View Table

Description of Figure 8-2 follows
Description of "Figure 8-2 Using XLA to Detect Updates on a Materialized View Table"

See TimesTen Classic Application Scenario for an example of a trading application that uses XLA and a materialized view to detect updates to specific stocks.

The TimesTen implementation of materialized views emphasizes performance as well as the ability to detect updates across multiple tables. Readers familiar with other implementations of materialized views should note that the following tradeoffs have been made:

  • The application must explicitly create materialized views. The TimesTen query optimizer has no facility to create materialized views automatically.

  • The query optimizer does not rewrite queries on the detail tables to reference materialized views. Application queries must directly reference views.

  • There are some restrictions to the SQL used to create materialized views.