我对 postgres 中的查询速度有疑问。
我在 psql (shell) 中运行这个查询:
"EXPLAIN ANALYZE select * from historial where empresa = 2";
结果是:
Execution time: 125.064 ms
然后我用 PHP 运行相同的查询:
$sql = "SELECT * FROM historial WHERE empresa = 2";
pg_query($db, $sql);
结果是:
Execution time: 1325.792 ms
哪个是实时的?