Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 15FFD632CDA for ; Thu, 26 Nov 2009 12:37:25 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 03474-09 for ; Thu, 26 Nov 2009 16:37:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hook.sigaev.ru (hook.sigaev.ru [212.192.243.50]) by mail.postgresql.org (Postfix) with ESMTP id 900F66328EA for ; Thu, 26 Nov 2009 12:37:16 -0400 (AST) Received: by hook.sigaev.ru (Postfix, from userid 1003) id B8398398F2; Thu, 26 Nov 2009 19:37:15 +0300 (MSK) Received: from xor.sai.msu.ru (toulouse.jfg-networks.net [82.224.249.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: teodor) by hook.sigaev.ru (Postfix) with ESMTPSA id 221E5398F7; Thu, 26 Nov 2009 19:37:14 +0300 (MSK) Message-ID: <4B0EAEB9.8050007@sigaev.ru> Date: Thu, 26 Nov 2009 19:37:13 +0300 From: Teodor Sigaev User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.23) Gecko/20090909 SeaMonkey/1.1.18 MIME-Version: 1.0 To: Simon Riggs CC: Pgsql Hackers Subject: Re: KNNGiST for knn-search References: <4B0AC9E1.5050509@sigaev.ru> <1259115190.27757.11194.camel@ebony> In-Reply-To: <1259115190.27757.11194.camel@ebony> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.11 tagged_above=-10 required=5 tests=BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 200911/1811 X-Sequence-Number: 150510 > explain select col1 from s order by abs(col1 - 5) limit 10; > > is the one-dimensional equivalent of the type of query you're proposing Exactly, it's already done in next version of patch :) > and that doesn't work either until you put an index on abs(col1 - 5), > then it just works, but only for k = 5. BTW, it's possible to add this feature to plain btree by changing traversal algorithm, but I'm fill enough power to do it. -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/