Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Indexing on fact and dimension tables

Posted on 2014-11-11
6
Medium Priority
?
113 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 49

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 49

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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

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 49

Accepted Solution

by:
PortletPaul earned 2000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

916 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