Implementing secondary indexes on fact tables. Is it a good idea?
3 posters
Page 1 of 1
Implementing secondary indexes on fact tables. Is it a good idea?
Hello, we have surrogate keys on our fact tables and dimension tables.
While designing my stars, I had to leave two columns (eg: doc_id and doc_item_num) that are a part of business keys on the fact table itself. The other columns were Customer Dimension and Date dimension. I defined the primary index as (doc_id, doc_item_num, dte_surr_key). This was a good selection as the users are running time-based queries quite often.
Now, on certain cases, the queries are being written with just doc_id, doc_item_num and the database is not able to respond. The query is taking a long time to respond. The DBA suggested we add secondary indexes on the fact table for doc_id and for doc_item_num. I know that adding secondary indexes on a fact table will slow down ETL load processes. I also read that adding additional indexes on fact tables is not a good practice.
Please, suggest any alternatives or your points of view on this one.
Thank you,
Sreekanth
While designing my stars, I had to leave two columns (eg: doc_id and doc_item_num) that are a part of business keys on the fact table itself. The other columns were Customer Dimension and Date dimension. I defined the primary index as (doc_id, doc_item_num, dte_surr_key). This was a good selection as the users are running time-based queries quite often.
Now, on certain cases, the queries are being written with just doc_id, doc_item_num and the database is not able to respond. The query is taking a long time to respond. The DBA suggested we add secondary indexes on the fact table for doc_id and for doc_item_num. I know that adding secondary indexes on a fact table will slow down ETL load processes. I also read that adding additional indexes on fact tables is not a good practice.
Please, suggest any alternatives or your points of view on this one.
Thank you,
Sreekanth
sreekanth573- Posts : 3
Join date : 2010-11-08
Location : Dublin
Re: Implementing secondary indexes on fact tables. Is it a good idea?
Drop indexes before loading and rebuild when done. Secondary indexes are fine and required.
BoxesAndLines- Posts : 1212
Join date : 2009-02-03
Location : USA
SQL Server?
If this is a SQL Server database then the engine can actually use the the existing clustered index for both those scenarios. It can use columns from left to right so if the index is set as you have specified "(doc_id, doc_item_num, dte_surr_key)" then the engine will still use this index to run a query where the predicates are "doc_id, doc_item_num" as they are the first two columns in the index.
As for dropping indexes to to clarify, only drop the non clustered indexes not the clustered index. Also this is not always a 100% sure shot to speed ETL processing.
As for dropping indexes to to clarify, only drop the non clustered indexes not the clustered index. Also this is not always a 100% sure shot to speed ETL processing.
TenchiJin- Posts : 4
Join date : 2011-11-28
Similar topics
» Implementing near real time reporting on fact tables
» Storing binaries/images in DWH good idea?
» Tall Narrow Dimension - A Good Idea?
» Is it a good idea to have a single STATUS table if we have to store multiple status in the data mart?
» Modelling question - Multiple fact tables with one to many relationships and querying from many fact tables
» Storing binaries/images in DWH good idea?
» Tall Narrow Dimension - A Good Idea?
» Is it a good idea to have a single STATUS table if we have to store multiple status in the data mart?
» Modelling question - Multiple fact tables with one to many relationships and querying from many fact tables
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum