Sachi's smart vacuum and analyze scripts

Scope: 

1. Restrict vacuum and analyze in prespecified maintenance window

2. Run vacuum and analyze separately not from a single command VACUUM ANALYZE'

3. vacuum and analyze table on a predefined threshold time

4. Smart analyze ( analyze only those columns necessary). Configurable and prepoulated

5. vacuum and analyze largest table first

6. Run multiple session --coming soon!!!!!!!!!!!!!!

Usage

gpadmin@sachi scripts]$ ./projectdb_maint_daily_sachi.sh

Sample log

VACUUM

ANALYZE "sachi"."sales_1_prt_2_2_prt_7_3_prt_asia"(id);;

ANALYZE

VACUUM "sachi"."sales_1_prt_2_2_prt_7_3_prt_europe";

VACUUM

ANALYZE "sachi"."sales_1_prt_2_2_prt_7_3_prt_europe"(id);;

ANALYZE

VACUUM "sachi"."sales_1_prt_2_2_prt_7_3_prt_other_regions";

VACUUM

ANALYZE "sachi"."sales_1_prt_2_2_prt_7_3_prt_other_regions"(id);;

ANALYZE

VACUUM "sachi"."sales_1_prt_2_2_prt_7_3_prt_usa";

VACUUM

ANALYZE "sachi"."sales_1_prt_2_2_prt_7_3_prt_usa"(id);;

ANALYZE

VACUUM "sachi"."sales_1_prt_2_2_prt_7";

VACUUM

ANALYZE "sachi"."sales_1_prt_2_2_prt_7"(id);;

ANALYZE

Runtime Exceeded Project maintenance Window. Now exiting!!!!!!!!

Script completed. Script log is available at /home/gpadmin/maintenance/logs

Filename:/home/gpadmin/maintenance/logs/projectdb_maint_daily_ouput_2014-11-11_09:45.log

[gpadmin@sachi scripts]$ ./projectdb_maint_daily_new.sh