2016-08-18 48 views
1

我怀疑postgres中查询的速度。shell命令psql vs php pg_query性能

我运行在PSQL此查询(壳):

"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 

它是什么时候?

回答

0

第二个一个是实际的SELECT执行的实时。

第一个是只花时间去分析查询。