Presentation is loading. Please wait.

Presentation is loading. Please wait.

Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata Performance Optimization.

Similar presentations


Presentation on theme: "Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata Performance Optimization."— Presentation transcript:

1 Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata Performance Optimization

2 Performance Optimization Tools and Techniques  Performance Optimization Techniques –Indexes Choices –Macros & Views –Reducing Row Size – Compression –Optimization Through SQL Tuning –Join Indexes –Hash Indexes –Partitioned Primary Index –Priority Scheduler –Expanding your Teradata configuration.  Query Analysis Tools –Explain/Visual Explain Facility –Query Capture Facility –Target Level Emulation –Teradata System Emulation Tool –Teradata Index Wizard –Teradata Statistics Wizard  System Monitoring –Resource Usage –Teradata Manager

3 Indexes Types of Indexes supported by Teradata  Unique Primary Index  Non-Unique Primary Index  Unique Secondary Index  Non-Unique Secondary Index

4 Unique/Non-Unique Indexes A Unique Index identifies one & only one data row A Non-Unique Index identifies one or many data rows

5 Criteria For Index Selection Primary Index *The column (or column set) chosen should be the set selection most frequently used to select rows from the table and should be unique (UPI) or close to unique (NUPI). Cont...

6 Criteria For Index Selection Secondary Index *Secondary indexes always have an associated subtable. *The column (or column set) chosen should be a frequently used set selection. *Large Table/Small table Joins :  Joins that involve three or more small tables and one large table are called Large Table/Small Table (LT/ST) joins.  The optimizer first joins the small tables together and then joins that result with the large table (also called as Product/Merge Join).  To work well, the join fields of the small table must comprise an index of the large table. The join fields do not have to be indexes in the small table.  Collect statistics for all tables on their indexes used in a query.

7 Value Ordered NUSIs NUSI rows are stores row hash order which is very efficient for the queries with equality condition on the SI column(s). Queries with inequality conditions on the SI column(s) typically does full table scan of SI subtable. Value ordered NUSI rows are sorted by data value. It is possible to search only a portion of the index subtable for a given range of key values. Value-ordered NUSIs are very efficient for range queries.

8 Partitioned Primary Index Performance benefit from data locality is achieved by creating local partitions of data rows within each virtual AMP. Following performance benefits can be achieved by PPI  Large performance gain for range queries.  Improves load time.  Deleting entire partition is very fast.  PI access are not affected.

9 Explain Facility Allows you to experiment with different approaches to an answer, then select the one that performs best. Provides information about the relative time the query would take to execute.

10 Identifying Columns to Index Run EXPLAINs on typical queries with and without indexes defined on various columns to determine which performs best. Run HELP INDEX tablename statements to produce information helpful for interpreting the EXPLAIN statements you run. Cont….

11 Identifying Columns to Index Run COLLECT STATISTICS on the tables to be indexed to provide data for assessing the cost/benefit balance afforded by indexes.

12 Macros Teradata macros are SQL statements that are stored on the server and executed there. Macros are particularly useful for improving performance.

13 Views Views provide a means for application programmers to develop and test SQL statements that are highly optimized. These views can then be provided to users who can use them without worrying about tying up system resources needlessly. Well written macros provide the same facility.

14 Compressing Columns Most frequent value of a column can be compressed to reduce the row size. Tables with large numbers of rows and fields with limited numbers of unique values are very good candidates for compression. CPU cost overhead for compression processing is minimal.

15 Optimization Through SQL Tuning  Correlated Sub queries  Correlated sub queries are faster than use of a temporary table as Correlated sub queries fully integrated with the global join plan to minimize the cost.  Case Expression  CASE expressions help increase performance because they return multiple results in a single pass over the data. SELECT item_number, item_description, item_price as “Current//Price”,CASE WHEN item_season = ‘summer' and item_count < 3 THEN item_price *(1-.50) WHEN item_season = ‘summer’ and item_count >= 3 THEN item_price *(1-.25) WHEN item_season = ‘spring’ THEN item_price * (1-.33) ELSE NULL END AS “Sale//Price” FROM inventory_table WHERE item_season in (‘spring’ or ‘summer’); Cont….

16 Optimization Through SQL Tuning  Ordered Analytical Functions  Using Ordered Analytical Functions, you can perform data analysis within the database engine itself taking full advantage of Teradata parallel architecture.  CALENDAR view for date related operations.  Optimized Empty table INSERT/SELECT. INSERT INTO Summary_Table SELECT * FROM Store1; INSERT INTO Summary_Table SELECT * FROM Store2; INSERT INTO Summary_Table SELECT * FROM Store3; INSERT INTO Summary_Table SELECT * FROM Store1 ; INSERT INTO Summary_Table SELECT * FROM Store2 ;INSERT INTO Summary_Table SELECT * FROM Store3;

17 Join Indexes A Join Index is a data structure that stores and maintains join results. Frequently executed joins can be stored in Join Indexes to improve performance. Join Indexes are maintained automatically. Join Index -  Stores pre-joins without de-normalizing the database.  Stores summary data without de-normalizing the database.  Replicates the tables on the same AMP for join. Sparse Index - Can be used to index a portion of a table.

18 Hash Indexes Hash indexes create a full or partial replication of a base table with a primary index on a foreign key column table to facilitate joins of very large tables by hashing them to the same AMP. Eliminate data distribution for join processing.

19 Priority Scheduling Can be used to control resources allocated to users. Administrator can specify performance group while creating the user. It manages resource distribution to improve performance of one application at the expense of other. Resource Partition } R H M L Weight 40 Weight 20 Weight 10 Weight 5 Performance Group Allocation Group

20 Additional SMP/MPP Nodes You can increase the performance of a Teradata RDBMS by adding SMP nodes to your system. Performance increases at a nearly linear rate with the addition of SMP nodes to the configuration. Each MPP system is certified to support as many as 512 nodes. More nodes can be added on a custom basis to improve Performance.


Download ppt "Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata Performance Optimization."

Similar presentations


Ads by Google