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 526639DCB80 for ; Fri, 20 Jan 2006 19:17:59 -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 03179-05 for ; Fri, 20 Jan 2006 19:17:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id 874F49DCB73 for ; Fri, 20 Jan 2006 18:57:45 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1F05CT-0003iG-P5 for pgsql-performance@postgresql.org; Fri, 20 Jan 2006 23:57:47 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1F05CZ-00076D-00 for ; Fri, 20 Jan 2006 23:57:51 +0100 Date: Fri, 20 Jan 2006 23:57:51 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: [GENERAL] Creation of tsearch2 index is very slow Message-ID: <20060120225751.GA27230@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <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> <7.0.1.0.2.20060120174141.039b03e8@earthlink.net> <6111.1137797436@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6111.1137797436@sss.pgh.pa.us> X-Operating-System: Linux 2.6.14.3 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.073 required=5 tests=[AWL=0.073] X-Spam-Score: 0.073 X-Spam-Level: X-Archive-Number: 200601/377 X-Sequence-Number: 16855 On Fri, Jan 20, 2006 at 05:50:36PM -0500, Tom Lane wrote: > Yeah, but fetching from a small constant table is pretty quick too; > I doubt it's worth getting involved in machine-specific assembly code > for this. I'm much more interested in the idea of improving the > furthest-distance algorithm in gtsvector_picksplit --- if we can do > that, it'll probably drop the distance calculation down to the point > where it's not really worth the trouble to assembly-code it. For the record: Could we do with a less-than-optimal split here? In that case, an extremely simple heuristic is: best = distance(0, 1) best_i = 0 best_j = 1 for i = 2..last: if distance(best_i, i) > best: best = distance(best_i, i) best_j = i else if distance(best_j, i) > best: best = distance(best_j, i) best_i = i I've tested it on various data, and although it's definitely not _correct_, it generally gets within 10%. /* Steinar */ -- Homepage: http://www.sesse.net/