COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: tupac_rd on 07 Jun 2010 08:59:35 AM

Title: Index on a column
Post by: tupac_rd on 07 Jun 2010 08:59:35 AM
Hello Gurus,

I have a question about how the indexing works in FM. We have a date dimension, with the index on the primary key of the table, a column called Date Key which always has data as for eg. 20100607, and it is a numeric. So if we filter on this column, the queries are faster because of the index. Now, we have a calculation based on the indexed column called Year Month text - to_char ( substr ( [Import View].[Date Dim].[Date Key] ,1,6)). So, if we filter on this new calculated column, will the index still be used, since the calculated column is using the indexed column.

Thanks
2pac
Title: Re: Index on a column
Post by: blom0344 on 08 Jun 2010 03:08:56 AM
Actually this has little to do with Cognos itself. The database optimizer will determine acces paths and the use of indices. Which leads to the question which database you are using..

The best way to find out is to generate explain plans for the queries involving the primary key and the query involving the derived column. A friendly DBA comes in handy , though on SQL Server things are really easy.

A 2nd approach is to use a special testtool like:
http://www.datamanipulation.net/SQLQueryStress/

which will give you some insight into the performance of queries. The output itself may not tell much , but it does allow you to compare results. If the query involving the derived column is very costly, this will show..
Title: Re: Index on a column
Post by: tupac_rd on 08 Jun 2010 11:31:02 AM
We are using Oracle. I will try out your suggestions. Meanwhile if you have any ideas or other suggestions specifically for Oracle please let me know.
Title: Re: Index on a column
Post by: blom0344 on 08 Jun 2010 12:48:50 PM
AFAIK the latest  Oracle versions allows you to index a pseudo column (calculated column) which may be better yet..

In your example you:

1. Change datatype through the cast from numeric to char
2. Change an object with a unique key/index to a non-unique one (daily grain is changed to monthly)

My bet would be that this too much for the optimizer and you will lose the index access 
Title: Re: Index on a column
Post by: tupac_rd on 09 Jun 2010 07:52:37 AM
Thanks Blom, I am trying to get this column added to the database and get an index created .......