Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

0

积分

1

好友

2

主题
1#
发表于 2013-4-2 17:11:48 | 查看: 3476| 回复: 5
oracle 当中关于查询重写的一致性设置参数一共有三个可选值:

  query_rewrite_integerity:
             values:
                       enforce
                       stale_tolerated
                       trusted

前面个两个都可以理解,trusted是如何解释的呢?什么条件下使用trusted?
最好能用例子说明一下?谢谢
2#
发表于 2013-4-2 20:17:30
FYI

enforced

Oracle enforces and guarantees consistency and integrity.

trusted

Oracle allows rewrites using relationships that have been declared, but that are not enforced by Oracle.

stale_tolerated

Oracle allows rewrites using unenforced relationships. Materialized views are eligible for rewrite even if they are known to be inconsistent with the underlying detail data.



The setting of the parameter QUERY_INTEGRITY_LEVEL in the session where query
rewrite is attempted determines whether Constraints & Dimensions will be taken
into account.

A1) If QUERY_REWRITE_INTEGRITY = ENFORCED

- Dimensions are not used
- Primary Key, Unique, Foreign Key & NOT NULL constraints must be ENABLE
  VALIDATE to be used
- View constraints will not be used

A2) If QUERY_REWRITE_INTEGRITY = TRUSTED or STALE_TOLERATED

- Dimensions are used
- Primary Key, Unique and Foreign Key constraints must be ENABLE NOVALIDATE RELY
  or ENABLE VALIDATE to be used
- NOT NULL constraints can be in any state
- View constraints must be DISABLE NOVALIDATE RELY to be used




回复 只看该作者 道具 举报

3#
发表于 2013-4-2 20:17:46
ODM FINDING:

TRUSTED Integrity Level
• Most practical setting for data warehouses
• MVs must contain fresh data
• Primary key, unique key, and foreign key
constraints should be ENABLED NOVALIDATE RELY
or ENABLE VALIDATE
• NOT NULL constraints can be in any state
• Uses relationships declared in dimensions
• Uses PREBUILT and view-based MVs
• Inaccurate results possible
query_rewrite_integrity = trusted


This setting is practical for most Data Warehouses because it is common practice for
constraints in such databases to be in ENABLED NOVALIDATE state. For such
constraints to be used for query rewrite, they must also be in RELY mode. Of course,
constraints will also be used if they are ENABLE VALIDATE (in this case
RELY/NORELY makes no difference).
MVs will be used for rewriting query blocks in more cases than the stricter
ENFORCED integrity level.
Inaccurate results may occur when:
• Relationships declared in dimensions are invalid (for example, when values at a
certain level of a dimension’s hierarchy do not roll up to exactly one parent
value). To avoid this problem, all dimensions should be validated using the
DBMS_OLAP.VALIDATE_DIMENSION procedure
• MVs are based on PREBUILT tables containing some data that violates
ENABLED NOVALIDATE constraints
• Relationships based on NOVALIDATE table or view constraints are bad because
some of the rows in the detail tables violate the constraints

回复 只看该作者 道具 举报

4#
发表于 2013-4-2 20:18:27
STALE_TOLERATED Integrity Level
• Most flexible setting of all
• MVs can contain stale data
• Inaccurate results possible in more cases
query_rewrite_integrity = stale_tolerated

In some data warehouses, data in some MVs can be out of synchronization with data
in their detail tables because of differences in refresh schedules and pending
refreshes following bulk load or other DML operations. Such MVs will contain
STALE data. If it is acceptable to have some inaccuracy in the rewritten queries, the
STALE_TOLERATED integrity level can be used. In other respects, this integrity
level is similar to TRUSTED.

回复 只看该作者 道具 举报

5#
发表于 2013-4-2 20:25:01

回复 只看该作者 道具 举报

6#
发表于 2013-4-12 08:25:38
thanks a lot. maclean. sorry, I am late.

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-6-15 02:14 , Processed in 0.047957 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569