Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to implement "Filtered Indexes" in Oracle?

437228Nov 23 2008 — edited Nov 13 2010
I know that function-based index can (kind-of) create index for only a portion of all the rows in a table,
create index idx_abc_01 on t_abc (case when end_dt > '01-APR-2008' then end_dt else null end);

/* to use the index, you have to use the same express in the filter clause */
select * from t_abc where xyz in ('O', 'S', 'X') and 
	case when end_dt > '01-APR-2008' then end_dt else null end 
		between '12-JUL-2008' and '15-JUL-2008';
But this approach is very inflexible because the expression in the where clause has to exactly match the index creation, otherwise that filtered index will not be used.

MS SQL Server 2008 has a new feature called - Filtered Indexes
CREATE NONCLUSTERED INDEX fidx_abc_01
    ON t_abc ( EndDate )
WHERE EndDate > '20040401';

select * from t_abc where EndDate between '20050121' and '20050130';
[url http://msdn.microsoft.com/en-us/library/cc280372.aspx]Filtered Indexes can be very helpful in both OLTP and DW. I'm wondering how to get the same thing done in Oracle.

Any suggestion beyond [url http://erturkdiriksoy.wordpress.com/2008/06/30/filtered-indexes-on-oracle/]Dunyada?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2010
Added on Nov 23 2008
1 comment
1,844 views