Mark Stosberg <mark@summersault.com> wrote:
> Sample EXPLAIN output and query times are below.
> Seq Scan on zipcodes (cost=0.00..1257.54 rows=41483 width=22)
> (actual time=0.019..84.543 rows=41483 loops=1)
> Index Scan using zipcodes_knn on zipcodes (cost=0.00..5365.93
> rows=41483 width=22) (actual time=0.451..141.590 rows=41483
> loops=1)
I thought the benefit of KNN was that you could retrieve the rows in
distance order, so that a query for the closest 20 locations (for
example) would be very fast. I wouldn't have expected it to be
helpful when you're selecting all the rows regardless of distance.
-Kevin