Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 2180F9FA3E7 for ; Wed, 15 Aug 2007 02:51:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 95941-06 for ; Wed, 15 Aug 2007 02:51:49 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.189]) by postgresql.org (Postfix) with ESMTP id 184C69FA3E6 for ; Wed, 15 Aug 2007 02:51:49 -0300 (ADT) Received: by fk-out-0910.google.com with SMTP id b27so2255124fka for ; Tue, 14 Aug 2007 22:51:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=a4MdpeJWWODcckJ7V43CTDX4gjH6GdKT0O6OvcAb8hkaLqudhVfYXAHvaK/m8HwnitVkYUYFzHnqNKz8uO3tnryuFe9ubh/pVDitrVuag20NoVf1R0Qz4IwvlMF7f4BSgS95rGkDwXXuJSYANv0v5MIdDVDruY/WouUILHOm6tQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=LboHF+DJlp4SMl7oOorWwRRNVlwGf2sHzZ1gOHHnNRuSljurxchu4kDT/Ofa46OLDZuv1VA7XN3dEHBcTqiE5QO4tyi7x5PG7/rHgVhwS/RREqBzH/l8x9nsn7ZI9S2hN2ijGF+HwPcIZ7UC84mZ07rbVofgyeJmgAUofTLOwQ8= Received: by 10.86.65.11 with SMTP id n11mr161482fga.1187157108550; Tue, 14 Aug 2007 22:51:48 -0700 (PDT) Received: from ?192.168.0.100? ( [80.222.48.97]) by mx.google.com with ESMTPS id e8sm27325823muf.2007.08.14.22.51.45 (version=SSLv3 cipher=RC4-MD5); Tue, 14 Aug 2007 22:51:47 -0700 (PDT) Message-ID: <46C29460.8070002@enterprisedb.com> Date: Wed, 15 Aug 2007 06:51:28 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Jeff Davis CC: "Decibel!" , Chris Browne , pgsql-hackers@postgresql.org Subject: Re: Index Tuple Compression Approach? References: <604pj1n777.fsf_-_@dba2.int.libertyrms.com> <20070814212739.GS54135@nasby.net> <1187135907.24264.44.camel@dogma.ljc.laika.com> In-Reply-To: <1187135907.24264.44.camel@dogma.ljc.laika.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/488 X-Sequence-Number: 106410 Jeff Davis wrote: > On Tue, 2007-08-14 at 16:27 -0500, Decibel! wrote: >> Isn't this what Grouped Index Tuples is? > > http://community.enterprisedb.com/git/git-readme.txt > > It looks like GIT is a little different. > > GIT actually stores a lower-bound key of a contiguous* range of keys > that all point to the same page, and for each of those ranges stores a > bitmap of page offsets. A search searches first for an exact match in > the index, and failing that, looks to see if the previous index tuple > happens to be one of these ranges. > > The algorithm Chris is talking about stores a set of tuple ids (which > include page and offset) for each distinct key. Right. > Both could be helpful, although I don't think they can work together > very well. What Chris is suggesting is basically a special case of GIT, where all the heap tuples represented by an index tuple have the same key. I was actually thinking of adding a flag to index tuples to indicate that special case in GIT. We could effectively do both. > GIT has the disadvantage that it's "lossy". It doesn't even store every > key in the index, so it can't be sure that the match actually is a > match. Thus, it returns candidate matches. That also has implications > for enforcing UNIQUE (although it's not impossible, according to the > readme). However, GIT can be used effectively on an index that happens > to be unique. GIT also assumes a tree structure, and makes no sense for > a hash index, and makes no sense for a types without ordering. GIT's > space savings is dependent on the clustering of the table. > > Chris's suggestion would work on a UNIQUE index, but would be no help at > all, because there would be no duplicate keys to collapse. However, it > could be used for non-tree indexes. The space savings for this strategy > is dependent on how repetitive the keys are. Right. I wasn't concerned about the case of a lot of duplicate keys, because the bitmap index is more efficient for that. And also because HOT should reduce the number of index tuples with duplicate keys pointing to different versions of the same row. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com