0
對heroku postgres我的組通過查詢超過2秒鐘,這是正常嗎?我怎樣才能進一步優化呢?兩列都被索引所以我假設它應該運行得更快。heroku postgres Group通過對索引列進行查詢需要2秒以上的時間才能執行
的查詢,
EXPLAIN ANALYZE(SELECT COUNT(*), context, call_type FROM call_tasks GROUP BY call_tasks.context, call_tasks.call_type);
查詢計劃和分析:
GroupAggregate (cost=0.08..11500.84 rows=12 width=11) (actual time=35.395..2545.426 rows=7 loops=1)
Group Key: context, call_type
-> Index Only Scan using index_call_tasks_on_context_and_call_type on call_tasks (cost=0.08..10338.79 rows=774677 width=11) (actual time=0.022..1480.729 rows=781076 loops=1)
Heap Fetches: 43682
Planning time: 0.085 ms
Execution time: 2545.464 ms
(6 rows)
我使用的愛好基本的數據庫。 https://elements.heroku.com/addons/heroku-postgresql。