- 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.
- 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;
- 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 ...