Added database optimization code.
Added vacuum analyze to PG