I have doubts about the speed of a query in postgres.
I run this query in psql (shell):
"EXPLAIN ANALYZE select * from historial where empresa = 2";
The result is:
Execution time: 125.064 ms
Then i run the same query with PHP:
$sql = "SELECT * FROM historial WHERE empresa = 2";
pg_query($db, $sql);
The result is:
Execution time: 1325.792 ms
which it is the real time ?
The second one is the real time of the actual
SELECT
execution.The first one is only the time it took to analyze the query.