Contents

Chapter 1 – The Teradata Fundamentals

What is Parallel Processing?

The Basics of a Single Computer

Teradata Parallel Processes Data

Parallel Architecture

All Teradata Tables are spread across ALL AMPS

Teradata Systems can Add AMPs for Linear Scalability

Teradata Parallel Processing

Teradata Systems can continue to grow to thousands of AMPs

How Teradata Creates Tables

Every AMP has the Exact Same Tables

All Teradata Tables are spread across All AMPs

Each Table has a Primary Index that is Unique or Non-Unique

The Hash Map Determines which AMP will own the Row

A Unique Primary Index Spreads the Data Evenly

A Non-Unique Primary Index Skews the Data

Comparing the Same Table with Different Primary Indexes

Unique Primary Index Queries are a Single AMP Retrieve

Using EXPLAIN

A Non-Unique Primary Index is also a Single AMP Retrieve

Using EXPLAIN in a NUPI Query

Teradata has a No Primary Index Table called a NoPI Table

A conceptual example of a Table with NO PRIMARY INDEX

A Full Table Scan is likely on a table with NO Primary Index

Table CREATE Examples with four different Primary Indexes

What happens when you forget the Primary Index?

Chapter 2 – The Teradata Users' Fastest Queries

Which Query is the Fastest?

Answer - Which Query is the Fastest?

Which Query is the Slowest?

Answer - Which Query is the Slowest?

Which Table is more likely to have a Unique Primary Index?

Answer - Which Table is more likely to have a Unique Primary Index?

How Many AMPs involved with an UPI?

Answer - How Many AMPs involved with an UPI?

How Many AMPs involved with a NUPI?

Answer - How Many AMPs involved with an NUPI?

Multi-Column Primary Index Quiz

Answer - Multi-Column Primary Index Quiz

Full Table Scan times vs. Single AMP retrieve

Answer - Full Table Scan times vs. Single AMP retrieve

Which Query is a Single AMP Retrieve?

Answer - Which Query is a Single AMP Retrieve?

Chapter 3 – Space

Perm and Spool Space

Perm Space is for Permanent Tables

Spool Space is work space that builds a User's Answer Sets

How is Spool Space like a Hotel Lobby?

Think of Spool Space like Aisles in a Grocery Store

When a User is created they are assigned a Spool Space Limit

All Spool Space is calculated on a Per AMP Basis

What is a common reason that a User runs out of Spool?

Why is a Database Assigned Spool Space?

Spool is an individual limit and not a Pool to Share

What is the Purpose of Spool Limits?

Perm Space is for Permanent Tables

Perm and Spool is Calculated on a Per AMP Basis

Why did my query Abort and say “Out of Spool”?

How come my Join caused me to run “Out of Spool”?

Finding out how much Space you have

Space per AMP on all tables in a Database shows Skew

Chapter 4 – The User Environment

DBC is the only user when the system first arrives

DBC will Create Databases and Give them Space

DBC will create some initial Users

A Typical Teradata Environment

What are Similarities between a DATABASE and a USER?

Roles

Create a Role and then Assign that Role Its Access Rights

Create a User and Assign them a Default Role

Granting Access Rights

There are Three Types of Access Rights

Description of the Three Types of Access Rights

Profiles

Creating a Profile and a User

ProfileInfoVX, RoleMembers, RoleInfo and UserRoleRights

Accounts and their Associated Priorities

Creating a User with Multiple Account Priorities

Account String Expansion (ASE)

The DBC.AMPUsage View

Teradata TASM provides a User Traffic System

Teradata Viewpoint

Chapter 5 - Three Options for Teradata Table Design

There are Three Options to Teradata Table Design

How Teradata Creates Traditional Tables

Each Table has a Primary Index

A Query Using the Primary Index is a Single AMP Retrieve

A Primary Index Query uses a Single AMP and Single Block

How Teradata Creates a PPI Table

PPI Table Sorting the Rows by Month of Order_Date

An All AMPs Retrieve By Way of a Single Partition

Creating a PPI Table with CASE_N

A Visual of Case_N Partitioning

An All AMPs Retrieve By Way of a Single Partition

What does a Columnar Table look like?

A Comparison of Data for Normal Vs. Columnar

A Columnar Table is best for Queries with Few Columns

Quiz – How Many Containers are in FSG Cache?

Answer – How Many Containers are in FSG Cache?

Intelligent Memory (Teradata V14.10)

Teradata V14.10 Intelligent Memory Gives Data a Temperature

Data deemed VeryHot stays in each AMP's Intelligent Memory

Intelligent Memory Stays in Memory

Factors When Choosing Table Design

Chapter 6 - Secondary Indexes

Teradata Primary and Secondary Index Cheat Sheet

Teradata Query Cheat Sheet

Creating a Unique Secondary Index (USI)

Creating a Non-Unique Secondary Index (NUSI)

Creating a Value-Ordered NUSI

NUSI BITMAP

The Facts on Primary Indexes, Secondary Indexes, and Full Table Scans

Multiple Choice DBA

Multiple Choice DBA

What are the Big Four Tactical Queries?

What are the Big Four Tactical Queries?

Chapter 7 - How Joins Work Under the Covers

Teradata Join Quiz

Teradata Join Quiz Answer

The Joining of Two Tables

Teradata Moves Joining Rows to the Same AMP

Imagine Joining Two NoPI Tables that have No Primary Index

Both Tables are redistributed to Join Rows on the Same AMP

How do you join if One Table is Big and One Table is small?

Duplicate the Small Table on Every AMP (like a mirror)

What Could You Do If Two Tables Joined 1000 Times a Day?

Joining Two Tables with the same PK/FK Primary Index

A Join With No Redistribution or Duplication

A Performance Tuning Technique for Large Joins

The Joining of Two Tables with an Additional WHERE Clause

An Example of the Fastest Join Possible

Using a Simple Volatile Table

A Volatile Table with a Primary Index

Using a Simple Global Temporary Table

Two Brilliant Techniques for Global Temporary Tables

The Joining of Two Tables Using a Global Temporary Table

Quiz – How Much Data Moves Across the BYNET?

Answer – How Much Data Moves Across the BYNET?

Chapter 8 - Collect Statistics

The Teradata Parsing Engine (Optimizer) is Cost Based

The Purpose of Collect Statistics

When Teradata Collects Statistics it Creates a Histogram

The Interval of the Collect Statistics Histogram

Histogram Quiz

Answers to Histogram Quiz

What to COLLECT STATISTICS On?

Why Collect Statistics?

How do you know if Statistics were Collected on a Table?

A Huge Hint that No Statistics Have Been Collected

The Basic Syntax for COLLECT STATISTICS

COLLECT STATISTICS Examples for a better Understanding

The New Teradata V14 Way to Collect Statistics

The Official Syntax for COLLECT STATISTICS

How to Re-COLLECT STATISTICS on a Table

How to Copy a Table with Data and the Statistics?

How to Copy a Table with NO Data and the Statistics?

When to COLLECT STATISTICS Using only a SAMPLE

Examples of COLLECT STATISTICS Using only a SAMPLE

Examples of COLLECT STATISTICS For V14

How to Collect Statistics on a PPI Table on the Partition

Chapter 9 - View Functions

Creating a Simple View

Basic Rules for Views

How to Modify a View

Exceptions to the ORDER BY Rule inside a View

How to Get HELP with a View

Views sometimes CREATED for Formatting or Row Security

Another Way to Alias Columns in a View CREATE

Resolving Aliasing Problems in a View CREATE

Resolving Aliasing Problems in a View CREATE

Resolving Aliasing Problems in a View CREATE

CREATING Views for Complex SQL such as Joins

WHY certain columns need Aliasing in a View

Aggregates on View Aggregates

Locking Row for Access

Altering a Table

Altering a Table after a View has been created

A View that errors After an ALTER

Troubleshooting a View

Updating Data in a Table through a View

Maintenance Restrictions on a Table through a View

Chapter 10 - Macro Functions

The 14 rules of Macros

CREATING and EXECUTING a Simple Macro

Multiple SQL Statements inside a Macro

Complex Joins inside a Macro

Passing an INPUT Parameter to a Macro

Troubleshooting a Macro with INPUT Parameters

Troubleshooting a Macro with INPUT Parameters

An UPDATE Macro with Two Input Parameters

Executing a Macro with Named (Not Positional) Parameters

Troubleshooting a Macro

Chapter 11 - Explain

EXPLAIN Keywords

EXPLAIN Keywords Continued

Explain Example – Full Table Scan

Explain Example – Unique Primary Index (UPI)

Explain Example – Non-Unique Primary Index (NUPI)

Explain Example – Unique Secondary Index (USI)

Explain Example – Redistributed to All-AMPs

Explain Example – Row Hash Match Scan

Explain Example – Duplicated on All-AMPs

Explain Example –Low Confidence

Explain Example – High Confidence

Explain Example – Product Join

Explain Example – BMSMS

Explain Terminology for Partitioned Primary Index Tables

Explain Example – From a Single Partition

Explain Example – From N Partitions

Explain Example – Partitions and Current_Date

Chapter 12 - Temporal Tables Create Functions

Three types of Temporal Tables

CREATING a Bi-Temporal Table

PERIOD Data Types

Bi-Temporal Data Type Standards

Bi-Temporal Example – Tera-Tom buys!

A Look at the Temporal Results

Bi-Temporal Example – Tera-Tom Sells!

Bi-Temporal Example – How the data looks!

Normal SQL for Bi-Temporal Tables

NONSEQUENCED SQL for Temporal Tables

AS OF SQL for Temporal Tables

NONSEQUENCED for Both

Creating Views for Temporal Tables

Bi-Temporal Example – Socrates is DELETED!

Bi-Temporal Results – Socrates is DELETED

Chapter 13 - Temporary Tables

There are three types of Temporary Tables

CREATING A Derived Table

Naming the Derived Table

Aliasing the Column Names in the Derived Table

Most Derived Tables Are Used To Join To Other Tables

Multiple Ways to Alias the Columns in a Derived Table

Our Join Example with a Different Column Aliasing Style

Column Aliasing Can Default for Normal Columns

CREATING A Derived Table using the WITH Command

Our Join Example With the WITH Syntax

The Same Derived Query shown Three Different Ways

Quiz - Answer the Questions

Answer to Quiz - Answer the Questions

Clever Tricks on Aliasing Columns in a Derived Table

A Derived Table lives only for the lifetime of a single query

An Example of Two Derived Tables in a Single Query

Creating a Volatile Table

You Populate a Volatile Table with an INSERT/SELECT

The Three Steps to Use a Volatile Table

Why Would You Use the ON COMMIT DELETE ROWS?

The HELP Volatile Table Command Shows your Volatiles

A Volatile Table with a Primary Index

The Joining of Two Tables Using a Volatile Table

You Can Collect Statistics on Volatile Tables

The New Teradata V14 Way to Collect Statistics

Four Examples of Creating a Volatile Table Quickly

Four Advanced Examples of Creating a Volatile Table Quickly

Creating Partitioned Primary Index (PPI) Volatile Tables

Using a Volatile Table to Get Rid of Duplicate Rows

Using a Simple Global Temporary Table

Two Brilliant Techniques for Global Temporary Tables

The Joining of Two Tables Using a Global Temporary Table

CREATING A Global Temporary Table

Chapter 14 – Top SQL Commands Cheat Sheet

SELECT All Columns from a Table and Sort

Select Specific Columns and Limiting the Rows

Changing your Default Database

Keywords that describe you

Select TOP Rows in a Rank Order

A Sample number of rows

Getting a Sample Percentage of rows

Find Information about a Database

Find information about a Table

Using Aggregates

Performing a Join

Performing a Join using ANSI Syntax

Using Date, Time, and Timestamp

Using Date Functions

Using the System Calendar

Using the System Calendar in a Query

Formatting Data

Using Rank

Using a Derived Table

Using a Subquery

Correlated Subquery

Using Substring

Basic CASE Statement

Advanced CASE Statement

Using an Access Lock in your SQL

Collect Statistics

CREATING a Volatile Table with a Primary Index

CREATING a Volatile Table that is Partitioned (PPI)

CREATING a Volatile Table that is deleted after the Query

Finding the Typical Rows per Value for specific column

Finding out how much Space you have

How much Space you have Per AMP

Finding your Space

Finding Space Skew in Tables in a Database

Finding the Number of rows per AMP for a Column

Finding Account Information

Ordered Analytics

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.62.168