Have you considered to create a view and then query the view? Should be much faster
http://www.postgresql.org/docs/9.2/static/sql-createview.html
Also, how's your table in terms of indexes?
Don't go indexing blindly, i've seen people just go and non cluster every column in hopes of making a query more efficient. But clusters have their drawbacks that should been overcome by the advantages they bring for the desired scenarios.
Postgres has something called "execution plans" : http://www.postgresql.org/docs/9.2/static/sql-explain.html
I've never used that one in postgres. but in MsSql and MySql I have used them and they are worth considering.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community