Re: application of KNN code to US zipcode searches?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-performance(at)postgresql(dot)org>, "Mark Stosberg" <mark(at)summersault(dot)com>
Subject: Re: application of KNN code to US zipcode searches?
Date: 2011-02-17 14:49:28
Message-ID: 4D5CE118020000250003AB83@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mark Stosberg <mark(at)summersault(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Stosberg 2011-02-17 15:20:58 Re: application of KNN code to US zipcode searches?
Previous Message Mark Stosberg 2011-02-17 14:40:56 application of KNN code to US zipcode searches?