Index on Database

I have two tables and no index is defined. This is a data warehouse tables that will be loaded into MS AS Cube.



What kind of index should I create on each tables ?
As there is no primary key on fact table, should I create individual index key for each attribute, or a single key combining all attributes ?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vitor MontalvãoMSSQL Senior EngineerCommented:
You should have at least a primary key in both tables and a foreign key in the fact tables to guarantee the relationship between tables.
Only after that you should start think in another indexes but that's depends on your queries.
AXISHKAuthor Commented:
Should I create separate logical index for each foreign key, or combine all foreign key within a single logical index ?

Vitor MontalvãoMSSQL Senior EngineerCommented:
Normally you should create an index for each FK so will boost the JOIN between tables.
Don't create a composite index just for saving indexes.
AXISHKAuthor Commented:
One quick question, what's my consideration to create a composite index over  a single index for each FK ?  Tks
Vitor MontalvãoMSSQL Senior EngineerCommented:
My recommendation is to create indexes for FK with the same fields. A composite index for a FK will only make sense if the FK is composed by more than one field.
If a table has for example 4 FK's and each FK are relative to different tables then you should create 4 indexes, one for each FK. But if for example the table only has a FK that is composed by 4 fields and relative only to another table, then you should create a composite index with those 4 fields.

Hope that I was clear.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.