postgresql - Postgis - ST_DWithin performance, again -


i have example table called global_points of 5 million records random geography points.

i've created index create index global_points_gix on public.global_points using gist (location);

i executed geography (not geometry) search polygon:

select count(*) global_points  st_dwithin(location, 'srid=4326; polygon((0 0, 50 0, 50 50, 0 0))', 0); 

execution of query takes ~30 sec on computer (hdd, 2 cores 2.8ghz, 8gb ram).

i've tried tricks (e.g. put polygon definition in separate table :

select  count(*) global_points , polygons b st_dwithin(b.location,a.location ,5e-05) , b.id=2; 

but made no significant performance improvement.

i executed search on table without index, again no difference above polygon table. smaller indexed polygon table query faster.

it possible else improve performance? know geographic search complicated, indexing should improve search speed.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -