【问题标题】:shell command psql vs php pg_query performanceshell 命令 psql vs php pg_query 性能
【发布时间】:2016-08-18 13:45:47
【问题描述】:

我对 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

哪个是实时的?

【问题讨论】:

    标签: php shell psql postgresql-9.4 pg-query


    【解决方案1】:

    SELECT实际执行的实时时间。

    第一个只是分析查询所花费的时间。

    【讨论】:

      猜你喜欢
      • 2023-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 2019-02-01
      • 2014-04-21
      • 2015-08-18
      相关资源
      最近更新 更多