小编J-D*_*awG的帖子

postgres_fdw 性能很慢

以下对外部的查询在 320 万行上执行大约需要 5 秒:

SELECT x."IncidentTypeCode", COUNT(x."IncidentTypeCode") 
FROM "IntterraNearRealTimeUnitReflexes300sForeign" x 
WHERE x."IncidentDateTime" >= '05/01/2016' 
GROUP BY x."IncidentTypeCode" 
ORDER BY 1;
Run Code Online (Sandbox Code Playgroud)

当我在普通表上执行相同的查询时,它会在 0.6 秒内返回。执行计划完全不同:

普通表

SELECT x."IncidentTypeCode", COUNT(x."IncidentTypeCode") 
FROM "IntterraNearRealTimeUnitReflexes300sForeign" x 
WHERE x."IncidentDateTime" >= '05/01/2016' 
GROUP BY x."IncidentTypeCode" 
ORDER BY 1;
Run Code Online (Sandbox Code Playgroud)

外表

Sort  (cost=226861.20..226861.21 rows=4 width=4) (actual time=646.447..646.448 rows=7 loops=1) 
  Sort Key: "IncidentTypeCode" 
  Sort Method: quicksort  Memory: 25kB 
  -> HashAggregate (cost=226861.12..226861.16 rows=4 width=4) (actual  time=646.433..646.434 rows=7 loops=1)
     Group Key: "IncidentTypeCode"
     -> Bitmap Heap Scan on "IntterraNearRealTimeUnitReflexes300s" x  (cost=10597.63..223318.41 rows=708542 width=4) …
Run Code Online (Sandbox Code Playgroud)

postgresql performance postgresql-fdw postgresql-9.5 query-performance

13
推荐指数
1
解决办法
5882
查看次数

PostGIS 可以在外部表上使用空间索引吗?

我正在尝试对一些外部空间表执行查询,这比在普通空间表上运行的时间长几个数量级,因为没有使用索引。

索引似乎正在处理非空间查询。

这是应该工作的东西还是不受支持?

postgresql performance index spatial postgis query-performance

1
推荐指数
1
解决办法
374
查看次数