Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Indexing on fact and dimension tables

Posted on 2014-11-11
6
Medium Priority
?
109 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
[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
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

705 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