Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 580C91337B94 for ; Thu, 17 Feb 2011 15:13:16 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 64529-03 for ; Thu, 17 Feb 2011 19:13:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id B02A81337B7E for ; Thu, 17 Feb 2011 15:13:08 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p1HJD5Yb012993; Thu, 17 Feb 2011 14:13:06 -0500 (EST) To: Heikki Linnakangas cc: Mark Stosberg , pgsql-performance@postgresql.org Subject: Re: application of KNN code to US zipcode searches? In-reply-to: <4D5D4FB9.8020709@enterprisedb.com> References: <4D5CE118020000250003AB83@gw.wicourts.gov> <4D5D4FB9.8020709@enterprisedb.com> Comments: In-reply-to Heikki Linnakangas message dated "Thu, 17 Feb 2011 18:41:29 +0200" Date: Thu, 17 Feb 2011 14:13:05 -0500 Message-ID: <12992.1297969985@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/433 X-Sequence-Number: 42571 Heikki Linnakangas writes: > The existing opclasses only support distance-to-a-point, but I believe > the KNN gist code is flexible enough that it could be used for distance > to the edge of a shape as well. Someone just needs to write the > operators and support functions. The distance has to be exactly computable from the index entry, so you'd need to store the whole shape in the index, not just a bounding box. Not sure how practical that will be for complex shapes. regards, tom lane