If you are receiving timeouts you should first check your indexes to make sure they are set up correctly. If you believe they are then consider creating a pg/sql script that can accept parameters, process the data and then return just the result data to the client.
You didn't mention which client you are talking about. That may be helpful in troubleshooting the issue.