?
Solved

Index on Database

Posted on 2014-11-12
5
Medium Priority
?
209 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 51

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 51

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 51

Accepted Solution

by:
Vitor Montalvão earned 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

765 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