0% found this document useful (0 votes)
239 views10 pages

Steps To Improve Teradata Query Performance

This document provides tips for improving query performance in Teradata. It recommends collecting statistics on joined columns, avoiding full table scans and product joins, and using features like EXISTS, GTTs, and diagnostic commands. Following these best practices such as proper indexing and statistics collection can increase performance, reduce issues, and improve customer satisfaction.

Uploaded by

Rajesh Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
239 views10 pages

Steps To Improve Teradata Query Performance

This document provides tips for improving query performance in Teradata. It recommends collecting statistics on joined columns, avoiding full table scans and product joins, and using features like EXISTS, GTTs, and diagnostic commands. Following these best practices such as proper indexing and statistics collection can increase performance, reduce issues, and improve customer satisfaction.

Uploaded by

Rajesh Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Best Practice

TCS Confidential

Teradata tips to
improve
performance
DC/ SC/ Geo/Practice: Best Practice
Name of the project/support fn: General
Name of the author: Savitha C V
Date Created:07-Oct-2012

7 February 2013

Description
Project / Context
The implementing teradata tips during coding will improve
performance and reduce performance cases when we move
code to production.

Purpose
1. Teradata query performance will increase
2. Reduce performance issues
3. Customer satisfaction will increase due to less issues

7 February 2013

How we did it
Teradata Performance Tuning - Basic step
Performance tuning thumb rules. Here are very basic steps which are used to
Performance Tuning any given query in given environment . As a prerequisite , make sure
- user has proper select rights and actual profile settings
- Enough space available to run and test the queries
1. Run explain plan (pressing F6 or EXPLAIN sel * ,)
Then see for potential information like
- No or low confidence
- Product joins conditions
- By way of an all row scan - FTS
- Translate
- Execution time is more than 3 mins

7 February 2013

How we did it
Teradata Performance Tuning - Basic Tips
Also check for
- Distinct or group by keywords in SQL query
- In/ not in keywords and check for the list of values generated for the same

Please follow the below tips to avoid No confidence, translate,


product join and FTS issues:
A. In case of product join scenarios, check for
- Proper usage of alias
- joining on matching columns
- Usage of join keywords - like specifying type of joins (ex. inner or outer )
- use union in case of "OR scenarios
- Ensure statistics are collected on join columns and this is especially
important if the columns you are joining on are not unique

7 February 2013

How we did it
Teradata Performance Tuning - Basic Tips contd.
B. collects stats
- Run command "diagnostic help stats on for the session"
- Gather information on columns on which stats has to be collected
- Collect stats on suggestions columns
- Also check for stats missing on PI, SI or columns used in joins - "help
stats <database name>.<table name>
- Make sure stats are re-collected when at-least 10% of data
changes
- remove unwanted stats or stat which hardly improves performance
of the queries
- Collect stats on columns instead of indexes since index dropped will
drop stats as well!!
- collect stats on index having multiple columns, this might be helpful
when these columns are used in join conditions
- Check if stats are re-created for tables whose structures have
some
changes
- Refresh your stats and make sure you have stats collected on the where
and ON criteria. Make sure you have stats collected on your NUSI.
7 February 2013

How we did it
Teradata Performance Tuning - Basic Tips contd.
c. Full table scan scenarios
- Try to avoid FTS scenarios as, it might take very long time to access
all the data in every amp in the system
- Make sure SI is defined on the columns which are used as part of
joins or Alternate access path.
-Collect stats on SI columns else there are chances where optimizer
might go for FTS even when SI is defined on that particular column
D. Global Temporary Tables usage
- Use GTTs where huge amount of data might be in the spool, through a
derived table or a volatile table. The advantage of GTT is that you can
collect stats on the join columns.
- For your information we can collect stats on Volatile temporary tables in
Teradata Version 13

7 February 2013

How we did it
Teradata Performance Tuning - Basic Tips contd.
1.Use EXISTS AND NOT EXISTS instead of IN and NOT IN function when we
have large data to improve performance
2. Use group by function instead of DISTINCT to avoid full table scan
3. Run the command below and then run EXPLAIN plan on that query to get
recommended stats for the particular query
DIAGNOSTIC HELPSTATS ON FOR SESSION;
4. To get a more detailed explain plan, run the command below before executing
EXPLAIN:
DIAGNOSTIC VERBOSEEXPLAIN ON FOR SESSION;

7 February 2013

Why this is a best practice


Justification
1.Performance issues will reduce.
2.Quality of code to be improved.
3.Emails from clients for providing good quality service.

Benefits
Issues will reduce due to which customer satisfaction will
increase. Good practice to follow up the steps while
coding

7 February 2013

How this may be adapted elsewhere


Replication
All the Teradata projects within TCS can adapt this
practice in order to improve the performance of the queries
and for good client appreciation/satisfaction.

Contact Info
Name : Savitha C V
Employee No. : 210055
Email ID : [email protected]

7 February 2013

You might also like