[postgis-users] help optimize distance calculation
shlyon+postgis at gmail.com
Wed Jan 28 08:30:58 PST 2009
Paul (and others),
I appreciate the suggestion, but that actually ended up making the
query take significantly longer!
I created an index on both of the 'the_geom' columns:
create index features_idx_geo on features using gist(the_geom)
create index grid_idx_geo on grid using gist(the_geom)
...thinking that this should speed up my query, then I run vacuum
analyze grid, features, but when I run explain analyze [my select
statement] I don't see any indication that my idxs are being used...
"GroupAggregate (cost=0.00..93.45 rows=1 width=204) (actual
time=12.732..12.734 rows=1 loops=1)"
" -> Nested Loop (cost=0.00..82.49 rows=2189 width=204) (actual
time=0.091..8.384 rows=2189 loops=1)"
" -> Index Scan using grid_pkey on grid (cost=0.00..8.71
rows=1 width=104) (actual time=0.054..0.060 rows=1 loops=1)"
" Index Cond: (gid = 1)"
" -> Seq Scan on features f (cost=0.00..51.89 rows=2189
width=100) (actual time=0.015..3.027 rows=2189 loops=1)"
"Total runtime: 12.872 ms"
What's up with that? Shouldn't I see some sort of grid/feature_idx_geo
in the analysis??
I'd really love other suggestions as how to optimize or just speed up
a little this distance calculation that I'm trying to perform.
More information about the postgis-users