sql script tuning
Hi,
Users have reported that a script is took 5 hours to complete which used to complete in 1 mins.
I collected data from sqlhc and found that the execution plan got changed. On checking Tables Statistics Versions i found the following
# | Table Name | Owner | Version Type | Save Time | Last Analyzed | Num Rows | Sample Size | Perc | Blocks | Avg Row Len |
---|---|---|---|---|---|---|---|---|---|---|
2 | TBMZB_STG_BSRO_SALES_MARGIN | MZB_BSRO_STG | CURRENT | 06-APR-17 | 422938 | 422938 | 100.0 | 942 | 64 | |
3 | TBMZB_STG_BSRO_SALES_MARGIN | MZB_BSRO_STG | HISTORY | 06-APR-17 12.10.14.098924 AM -05:00 | 04-APR-17 | 1901133 | 1901133 | 100.0 | 4308 | 64 |
4 | TBMZB_STG_BSRO_SALES_MARGIN | MZB_BSRO_STG | HISTORY | 04-APR-17 11.28.04.017356 PM -05:00 | 04-APR-17 | 0 | 0 | 0 | 0 | |
5 | TBMZB_STG_BSRO_SALES_MARGIN | MZB_BSRO_STG |