I have a setup for connecting to a postgresql database the works like this:
- Apache
- PHP pg_connect
- prepared_statement
- ip address to server
- pg_bouncer
- unix socket
- return queried data
When I return the query without PHP it takes 900 milliseconds to execute, or .9 seconds. But the page load with the query takes 4 seconds to load, so that is around 3 seconds in connection. I'm using Rackspace as my hosting so its not the connection speed. How can I improve the performance of PHP connecting to to the database database server?