Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 392E964FCCA for ; Fri, 4 Jul 2008 16:20:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 65331-08 for ; Fri, 4 Jul 2008 16:20:17 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id 4999164FCC9 for ; Fri, 4 Jul 2008 16:20:19 -0300 (ADT) thread-index: AcjeCxwqAbqUz2XgTuCKuGP8Qqf3ZA== Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4133 Received: from [80.222.70.18] ([80.222.70.18]) by mail01.enterprisedb.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 4 Jul 2008 15:21:06 -0400 Message-ID: <486E77E8.6010404@enterprisedb.com> Date: Fri, 04 Jul 2008 22:20:08 +0300 From: "Heikki Linnakangas" Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509) MIME-Version: 1.0 To: "Tom Lane" Cc: =?utf-8?Q?Jan_Urba=C5=84ski?= , "Postgres - Hackers" Subject: Re: gsoc, text search selectivity and dllist enhancments References: <48649261.5040703@students.mimuw.edu.pl> <6233.1215113144@sss.pgh.pa.us> <486DD210.9030400@enterprisedb.com> <23365.1215186836@sss.pgh.pa.us> In-Reply-To: <23365.1215186836@sss.pgh.pa.us> Content-Type: text/plain; format=flowed; charset="UTF-8" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Jul 2008 19:21:06.0734 (UTC) FILETIME=[1B7E7CE0:01C8DE0B] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/225 X-Sequence-Number: 120485 Tom Lane wrote: > "Heikki Linnakangas" writes: >> Tom Lane wrote: >>> The data structure I'd suggest is a simple array of pointers >>> to the underlying hash table entries. Since you have a predetermined >>> maximum number of lexemes to track, you can just palloc the array once >>> --- you don't need the expansibility properties of a list. > >> The number of lexemes isn't predetermined. It's 2 * (longest tsvector >> seen so far), and we don't know beforehand how long the longest tsvector is. > > Hmm, I had just assumed without looking too closely that it was stats > target times a fudge factor. What is the rationale for doing it as > above? I don't think I like the idea of the limit varying over the > course of the scan --- that means that lexemes in different places > in the input will have significantly different probabilities of > surviving to the final result. Well, clearly if the list is smaller than the longest tsvector, inserting all elements of that long tsvector will flush out all other entries. Or if we throw away the newly inserted entries, some elements will never have a chance to climb up the list. I'm not sure where the "times two" figure comes from, maybe it's just a fudge factor, but the bottom line is that the minimum size needed depends on the size of the longest tsvector. (Jan is offline until Saturday...) -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com