Add some optimization

Add optim from https://www.periscope.io/blog/optimizing-your-psql.html?utm_source=postgresweekly&utm_medium=email