Solved

Indexing on fact and dimension tables

Posted on 2014-11-11
6
84 Views
Last Modified: 2016-02-18
Will there be any benefit if I add index for all surrogate key in Fact tables and the primary key on all dimension tables ? What kinds of index key should be defined on each tables ? Please provide the TSQL that I need to run on dimenions and fact tables.

Currently, nothing is defined in the tables. Is there another way to increase the query for the SSAS ?

Tks

DIM_Customer (similar layout for other dimension tables)
---------------------
Customer_IDX
Customer
Name

FACT_SALES_INVOICE
------------------------------
CURRENTCY_IDX
REGION_COUNTRY_IDX
TRANSDATE
CUSTOMER_IDX
SALESMAN_IDX
:
:
0
Comment
Question by:AXISHK
  • 3
  • 3
6 Comments
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40436728
Will there be any benefit if I add index for all surrogate key in Fact tables  ...?
YES

... and the primary key on all dimension tables ?
YES

I'm really rather surprised you have "dims & facts" without indexing.

In SQL Server the most important indexing decision is what will be the used for the clustered index as this shapes the physical means of storage on disk.

Are you absolutely certain there are no indexes on any of these tables?
0
 

Author Comment

by:AXISHK
ID: 40439094
Will it affect the processing speed of the cube, or affect the querying performance on the cube ?

Do I need to specify clustered index for primary key ?

Do I need to group any surrogate key in a single index, say

Current schema
DIM_CURRENCY (CURRENCY_IDX, CURRENCYCODE, NAME, SYMBOL, RATE)
FACT_SALES_INVOICE (CURRENCY_IDX, REGION_COUNTRY, TRANSDATE, CUSTOMER_IDX, SALESMAN_IDX, BASEAMOUNT, QTY, INVOICENO, COMPANY)

CREATE UNIQUE CLUSTERED INDEX PIndex
ON DIM_CURRENCY (CURRRENCY_IDX)

CREATE INDEX PIndex
ON FACT_SALES_INVOICE (CURRENTCY_IDX, REGION_COUNTRY_IDX, TRANSDATE, CUSTOMER_IDX, SALESMAN_IDX)

It seems that Fact Invoice doesn't have a primary key.

Any suggestion ?
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40439100
It is not mandatory in database design that every table has a unique integer on every row,
it is extremely common but not mandatory.

It appears that the fact table DOES have a primary key, it just happens to involve multiple fields
(CURRENTCY_IDX, REGION_COUNTRY_IDX, TRANSDATE, CUSTOMER_IDX, SALESMAN_IDX)

However I doubt you can have so many indexes defined as "PIndex"

To second guess a database design from virtually no information or background is not a worthwhile activity and could be misleading for you. I would pose these questions to the database designer(s) or look for documentation on the design.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:AXISHK
ID: 40439217
Sorry, should create a single index with multiple fields, or create individual index for each surrogate (foreign key) ? Tks
0
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 40439220
I do not know - with any certainty - through lack of knowledge - what your best options are.

Please discuss with the designer(s).
0
 

Author Closing Comment

by:AXISHK
ID: 40439332
Tks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now