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。