Optimizing SaaS with PostgreSQL