Re: application of KNN code to US zipcode searches? - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: application of KNN code to US zipcode searches?
Date
Msg-id 4D5CE118020000250003AB83@gw.wicourts.gov
Whole thread Raw
In response to application of KNN code to US zipcode searches?  (Mark Stosberg <mark@summersault.com>)
Responses Re: application of KNN code to US zipcode searches?
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Mark Stosberg
Date:
Subject: application of KNN code to US zipcode searches?
Next
From: Mark Stosberg
Date:
Subject: Re: application of KNN code to US zipcode searches?