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
它是什麼時候?