Re: function based indexes

  • From: Tim Gorman <tim@xxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 12 Aug 2004 19:21:06 -0600

The setting of the parameter QUERY_REWRITE_INTEGRITY has no bearing on
anything but query rewrite in materialized views...

SQL> create index initcap_ename on emp(initcap(ename)) compute statistics;

Index created.

SQL> show parameter rewrite

NAME                        TYPE        VALUE
--------------------------- ----------- ---------------
query_rewrite_enabled       string      TRUE
query_rewrite_integrity     string      STALE_TOLERATED

SQL> set autotrace traceonly explain
SQL> select ename from emp where initcap(ename) = 'Smith';

Execution Plan
----------------------------------------------------------
  0   SELECT STATEMENT Optimizer=CHOOSE
  1  0  TABLE ACCESS (BY INDEX ROWID) OF 'EMP'
  2  1    INDEX (RANGE SCAN) OF 'INITCAP_ENAME' (NON-UNIQUE)

The hoops to be jumped through to enable FBI are:

  1. COMPATIBLE >= 8.1.0
  2. OPTIMIZER_MODE <> rule
  3. QUERY_REWRITE_ENABLED = true
  4. QUERY REWRITE or GLOBAL QUERY REWRITE permission granted
  5. CBO statistics gathered on the index

Hope this helps...

-Tim


on 8/11/04 8:20 PM, Mohammed Shakir at mshakir08816@xxxxxxxxx wrote:

> I had to do the following to get function based indexes working.
> But I have Oracle 9i. You can check 10g documentation to confirm.
> 
> You must have the following initialization parameters defined to create
> a function-based index:
> 
> QUERY_REWRITE_INTEGRITY must be set to TRUSTED
> 
> QUERY_REWRITE_ENABLED must be set to TRUE
> 
> COMPATIBLE must set to 8.1.0.0.0 or a greater value
> 
> 
> Shakir
> 
> 
> --- Harvinder Singh <Harvinder.Singh@xxxxxxxxxxxxx> wrote:
> 
>> Hi,
>> 
>> We are creating function based indexes and have question about parameter
>> query_rewrite_integrity. Docs says value for this parameter should be
>> trusted to be able to use FBT but even when I set this parameter setting
>> to ENFORCED, optimizer is able to use index. So what should be the value
>> of this parameter to be able to use function based indexes?
>> We are using 10g on red hat linux
>> 
>> Thanks
>> --Harvinder
> 
> 
> =====
> Mohammed Shakir
> CompuSoft, Inc.
> 11 Heather Way
> East Brunswick, NJ 08816-2825
> (732) 672-0464 (Cell)
> (732) 257-6001 (Home)

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: