How to do it...

  1. There are two ways to collect stats; first, the old way:
COLLECT STATISTICS COLUMN(p_pricetime,p_priceID) ON prices;COLLECT STATISTICS COLUMN(p_pricetime) ON price;

The disadvantage of this syntax is the optimizer needs to scan the table twice, hence consuming more resources. Both of the statements here are independent of each other.

  1. Secondly, the effective way:
COLLECT STATISTICS COLUMN (q_area,q_amount) <--Read base table /Index for multicolumn aggregation,COLUMN (q_amount) <--Rollup from multicolumn aggregation resultON quantity;
  1. Run the following stats command on the table defined in the Getting ready section:
/*Collecting Statistics on table*/
COLLECT STATISTICS
 COLUMN (id,DEPT) --Read base table /Index for multicolumn ...

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.