Solved

Index on Database

Posted on 2014-11-12
5
207 Views
Last Modified: 2014-11-24
I have two tables and no index is defined. This is a data warehouse tables that will be loaded into MS AS Cube.

DIM_CURRENCY (CURRENCY_IDX, CURRENCYCODE, NAME, SYMBOL, RATE)

FACT_SALES_INVOICE (CURRENCY_IDX, REGION_COUNTRY, TRANSDATE, CUSTOMER_IDX, SALESMAN_IDX, BASEAMOUNT, QTY, INVOICENO, COMPANY)

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 ?

Tks
0
Comment
Question by:AXISHK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 40439383
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.
0
 

Author Comment

by:AXISHK
ID: 40439943
Should I create separate logical index for each foreign key, or combine all foreign key within a single logical index ?

Tks
0
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 40439975
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.
0
 

Author Comment

by:AXISHK
ID: 40440000
One quick question, what's my consideration to create a composite index over  a single index for each FK ?  Tks
0
 
LVL 50

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40440071
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.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question