Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 86A139F988D for ; Thu, 16 Aug 2007 12:04:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 39895-05 for ; Thu, 16 Aug 2007 12:04:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 984DB9F984D for ; Thu, 16 Aug 2007 12:04:04 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A07E63144C; Thu, 16 Aug 2007 17:04:03 +0200 (MET DST) From: Chris Browne X-Newsgroups: pgsql.hackers Subject: Re: Index Tuple Compression Approach? Date: Thu, 16 Aug 2007 10:50:36 -0400 Organization: cbbrowne Computing Inc Lines: 49 Message-ID: <608x8bpm83.fsf@dba2.int.libertyrms.com> References: <604pj1n777.fsf_-_@dba2.int.libertyrms.com> <758d5e7f0708150610j3e6ee948i760d01b91ca29c81@mail.gmail.com> <758d5e7f0708150939w1a08590aw1abcfcde402122df@mail.gmail.com> <46C3548C.90100@enterprisedb.com> <87bqd8y0w6.fsf@oxford.xeocode.com> <46C3F320.1010809@enterprisedb.com> <873ayjyl68.fsf@oxford.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.20 (linux) Cancel-Lock: sha1:qzIFeQhtOCqL2DPHmBiO/r0uOsU= To: pgsql-hackers@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/562 X-Sequence-Number: 106484 stark@enterprisedb.com (Gregory Stark) writes: > "Heikki Linnakangas" writes: > >> Gregory Stark wrote: >>> "Heikki Linnakangas" writes: >>> >>>> That general approach of storing a common part leading part just once is >>>> called prefix compression. Yeah, it helps a lot on long text fields. >>>> Tree structures like file paths in particular. >>> >>> You kind of want to do avoid both the prefix and the suffix, no? >> >> You're much more likely to find common prefixes than suffixes in an >> index page, because of the ordering. I suppose compressing the suffix >> would be useful in some cases as well. You might be better off with some >> generic compression algorithm at that point, though. > > Sorry, by "suffix" I don't mean common sufixes, I mean the bits of the key > following the point which discriminates between the left and right side of the > tree. > > So for example if you're indexing a text field and have a > tree structure like: > > Redhat Fedora Core 7 > / \ > Debian Etch (Unstable) Ubuntu hoary > > We don't really need the whole of "Redhat Fedora Core 7" in the index node. We > could actually get by with just "R". Everything before "R" is on the left and > everything after "R" is on the right. Right. The case where you get more characters than just "R" is when you introduce extra entries that have the same prefix. Say, "Redhat Fedora Core 4", "Redhat Fedora Core 5", "Redhat Fedora Core 6". And, for good measure, let's throw in "Redhat RHAS 3", "Redhat RHAS 4", and "Redhat RHAS 5". In that case, you'd have substrings: "R" "edhat " "Fedora Core " "RHAS " as discriminators. -- "cbbrowne","@","cbbrowne.com" http://www3.sympatico.ca/cbbrowne/spreadsheets.html If a mute swears, does his mother wash his hands with soap?