You are on page 1of 21

INDEX IN TERADATA

BY
Raniendu Singh, Manisha Mishra, Mohd. Sameed
OBJECTIVES

• Introduction to Indexes

• Data Distribution in Teradata

• Types of Indexes

• Primary Indexes

• Secondary Indexes

• Key v/s Index

• Comparison between Indexes


INTRODUCTION

• Indexes are used to

- Define data distribution

- Locate and Access data quickly


DATA DISTRIBUTION

• Even Data Distribution

• Skewed Data Distribution


EVEN DATA DISTRIBUTION
SKEWED DATA DISTIBUTION
TYPES OF INDEX

• Primary Index
• Unique Primary Index (UPI)
• Non-Unique Primary Index (NUPI)

• Secondary Index
• Unique Secondary Index (USI)
• Non-Unique Secondary Index (NUSI)
PRIMARY INDEX

• Introduction
• Physical mechanism for data distribution and access
• Always one-AMP operation
• Created at time of table creation
• Most critical decision for DB designer
RULES FOR PI

• One PI per table


• Unique or Non-unique
• Can be Null
• Can be modified
• Column Limit
TYPES OF PI
DATA DISTRIBUTION
DUPLICATE ROW HASH VALUES
ACCESSING DATA WITH PI
SECONDARY INDEX

• Introduction
• SI Rules
• SI is optional
• Unique or Non-unique
• Can be Null
• Can be modified
• Column Limit
TYPES SECONDARY INDEX

• Unique Secondary Index

• Non-unique Secondary Index


ACCESSING DATA WITH USI
ACCESSING DATA WITH NUSI
KEYS V/S INDEX

Keys Indexes

A relational modeling A Teradata Database


convention used in a logical mechanism used in a physical
data model. database design.
Uniquely identify a row Used for row distribution
(Primary Key). (Primary Index).

Establish relationships Used for row access (Primary


between tables (Foreign Key). Index and Secondary Index).
INDEX COMPARISON

Rule Primary Key Foreign Key Primary Index Secondary Index


1 One PK Multiple FKs One PI 0 to 32 SIs
Unique or non-
2 Unique values Unique or non-unique Unique or non-unique
unique
3 No NULLs NULLs allowed NULLs allowed NULLs allowed
Values should not Values may be Values may be changed Values may be
4
change changed (redistributes row) changed
Column cannot be Index may be
Column should not Column should not
5 changed (drop and changed (drop and
change change
recreate table) recreate index)
6 No column limit No column limit 64-column limit 64-column limit
FK must exist as PK
7 n/a n/a n/a
in the related table
THANK YOU …

You might also like