X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C6D929DCBB1 for ; Fri, 20 Jan 2006 18:29:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90180-09-5 for ; Fri, 20 Jan 2006 18:29:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth04.mail.atl.earthlink.net (smtpauth04.mail.atl.earthlink.net [209.86.89.64]) by postgresql.org (Postfix) with ESMTP id 8EE589DCB98 for ; Fri, 20 Jan 2006 18:29:50 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=QbkICTfa6f0InnozJwdO1QLdWnX5X+1pY1OcU9ELSrasF/BbXda1WnAklz2T+FfS; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.189.241] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth04.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1F04lT-0008UM-Df; Fri, 20 Jan 2006 17:29:51 -0500 Message-Id: <7.0.1.0.2.20060120172335.039f5e20@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Date: Fri, 20 Jan 2006 17:29:46 -0500 To: Tom Lane ,pgsql-performance@postgresql.org From: Ron Subject: Re: [GENERAL] Creation of tsearch2 index is very slow In-Reply-To: <20060120221655.GA22581@uio.no> References: <43D0ED57.1020608@gmx.de> <17454.1137771321@sss.pgh.pa.us> <20060120170452.GC31908@svana.org> <26153.1137784469@sss.pgh.pa.us> <20060120201036.GE31908@svana.org> <26583.1137788505@sss.pgh.pa.us> <20060120205132.GF31908@svana.org> <26958.1137791955@sss.pgh.pa.us> <20060120213754.GG31908@svana.org> <27264.1137793817@sss.pgh.pa.us> <20060120221655.GA22581@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc0afdd2161bb28400118ded016d3efeb2350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.189.241 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.425 required=5 tests=[AWL=-0.054, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.425 X-Spam-Level: X-Archive-Number: 200601/370 X-Sequence-Number: 16848 At 05:16 PM 1/20/2006, Steinar H. Gunderson wrote: >On Fri, Jan 20, 2006 at 04:50:17PM -0500, Tom Lane wrote: > > I wonder if there is a way to improve on that. > >Ooh, the farthest pair problem (in an N-dimensional vector space, though). >I'm pretty sure problems like this has been studied quite extensively in the >literature, although perhaps not with the same norm. It's known under both >"farthest pair" and "diameter", and probably others. I'm fairly sure it >should be solvable in at least O(n log n). If the N-dimensional space is Euclidean (any is the same distance apart in dimension x), then finding the farthest pair can be done in at least O(n). If you do not want the actual distance and can create the proper data structures, particularly if you can update them incrementally as you generate pairs, it is often possible to solve this problem in O(lg n) or O(1). I'll do some grinding. Ron