Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 3A5C79FB9CA for ; Fri, 20 Apr 2007 20:42:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60718-05 for ; Fri, 20 Apr 2007 20:42:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from smtp5.clear.net.nz (smtp5.clear.net.nz [203.97.33.68]) by postgresql.org (Postfix) with ESMTP id 51D8B9FB9C9 for ; Fri, 20 Apr 2007 20:42:43 -0300 (ADT) Received: from [192.168.1.11] (121-72-68-208.dsl.telstraclear.net [121.72.68.208]) by smtp5.clear.net.nz (CLEAR Net Mail) with ESMTP id <0JGT00N98LUZ2X10@smtp5.clear.net.nz> for pgsql-performance@postgresql.org; Sat, 21 Apr 2007 11:42:36 +1200 (NZST) Date: Sat, 21 Apr 2007 11:42:35 +1200 From: Mark Kirkwood Subject: Re: index structure for 114-dimension vector In-reply-to: <1177105284.28383.31.camel@dogma.v10.wvs> To: Jeff Davis Cc: Andrew Lazarus , pgsql-performance@postgresql.org Message-id: <46294FEB.9010909@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <01db01c781e4$c700bf30$2e00a8c0@tridecap.com> <1217328326.20070420120729@pillette.com> <1177105284.28383.31.camel@dogma.v10.wvs> User-Agent: Thunderbird 1.5.0.10 (X11/20070313) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/352 X-Sequence-Number: 24229 Jeff Davis wrote: > On Fri, 2007-04-20 at 12:07 -0700, Andrew Lazarus wrote: >> I have a table with 2.5 million real[] arrays. (They are points in a >> time series.) Given a new array X, I'd like to find, say, the 25 >> closest to X in some sense--for simplification, let's just say in the >> usual vector norm. Speed is critical here, and everything I have tried >> has been too slow. >> >> I imported the cube contrib package, and I tried creating an index on >> a cube of the last 6 elements, which are the most important. Then I > > Have you tried just making normal indexes on each of the last 6 elements > and see if postgresql will use a BitmapAnd to combine them? > > I don't think that will work for the vector norm i.e: |x - y| = sqrt(sum over j ((x[j] - y[j])^2)) Cheers Mark