Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Function-based indexes and histograms

Re: Function-based indexes and histograms

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Mon, 14 Jan 2002 21:37:37 +0100
Message-ID: <3ag64ugnvqaeheoi66gpmfie496mkae7lr@4ax.com>


On 14 Jan 2002 10:49:16 -0800, barnest_at_san.rr.com (Tom Barnes) wrote:

>Let's say I create a function-based index like this:
>
>CREATE INDEX my_index ON table1(SUBSTR(col1,1,10));
>
>and then I create a histogram for col1, like this:
>
>EXECUTE DBMS_STATS.GATHER_TABLE_STATS('tom','table1', METHOD_OPT =>
>'FOR COLUMNS SIZE 100 col1');
>
>Will Oracle somehow use the histogram when encountering a query with
>the SUBSTR(COL1,1,10) expression in the where-clause or should I just
>not bother creating the histogram and instead create a new column,
>col2, containing the SUBSTR(col1,1,10) data and build my index and
>histogram using col2?
>
>Oracle8i Enterprise Edition 8.1.6 on Solaris
>
>Thanks,
>
>Tom

Oracle will
- not use histograms for function based indexes - use the first *5* characters *only* to determine the histogram for varchar2 columns

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Mon Jan 14 2002 - 14:37:37 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US