我有主要索引問題。 我有'geog'(geography,multipolygon)列的表'國家'。 我也有這個專欄的要點。 這與ST_CoveredBy()針對與2行表(每個「的GeOG」約5MB)簡單的查詢需要13秒(查詢結果是正確的):postgis中的空間主題索引 - 性能
select c."ID" from gis.country c where ST_CoveredBy(ST_GeogFromText('SRID=4326;POINT(8.4375 58.5791015625)'), c."geog") =true
當我DROP掉索引,查詢也採取了13S 。
我已經做了:
- VACUUM ANALYZE gis.country( 「的GeOG」)
- 也許這就是問題所在: 「不要用GEOMETRYCOLLECTION作爲參數調用」 我已閱讀(http://www.mail-archive.com/[email protected]/msg17780.html),那是因爲重疊的多邊形,但在全國地圖不存在重疊的多邊形
編輯
查詢計劃 -
Index Scan using sindx_country_geography_col1 on country c (cost=0.00..8.52 rows=1 width=4)
Index Cond: ('0101000020E61000000000000000E0204000000000204A4D40'::geography && "geog")
Filter: _st_covers("geog", '0101000020E61000000000000000E0204000000000204A4D40'::geography)
請發佈查詢計劃。該索引很難用於具有「2」行的表格。使用sindx_country_geography_col1上國家C – Quassnoi
索引掃描(成本= 0.00..8.52行= 1米寬度= 4) 指數電導率:( '0101000020E61000000000000000E0204000000000204A4D40' ::地理&& 「的GeOG」) 過濾器:_st_covers( 「的GeOG」, '0101000020E61000000000000000E0204000000000204A4D40' :: geography) –
查詢確實使用索引。 – Quassnoi