This article discusses the performance of nearest neighbor queries in PostgreSQL and talks about optimization measures that address performance issues.
This article discusses the nearest-neighbor enhancement added in PostgreSQL 9.1 for sorting GiST indexes with sample code and examines the performance using test data.