Running the query directly to the PostgreSQL takes 3-8ms. The PostgreSQL can handle 500 concurrent connections. The Apache server is running on 8 core CPUs. Analyzing the Apache access logs: There are 14-21 request served per sec. Requesting via the browser, it takes about 300ms TTFB waiting time, 3ms content download, 1ms initial connection (ping). I would really want to know the time spent to convert the request to a query and also the time taken to process the data from the PSQL to the response. What should I do to reduce the waiting time (TTFB)?