X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6E16653979; Tue, 10 May 2005 10:53:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44108-07; Tue, 10 May 2005 13:53:31 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id EA24B5398F; Tue, 10 May 2005 10:53:30 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j4ADrIZv009872; Tue, 10 May 2005 09:53:18 -0400 (EDT) To: Greg Stark Cc: Neil Conway , "Jim C. Nasby" , Christopher Petrilli , Ying Lu , pgsql-general@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL In-reply-to: <878y2nsj7i.fsf@stark.xeocode.com> References: <427F6853.90308@cs.concordia.ca> <427F757A.8000407@samurai.com> <59d991c405050908271b55e673@mail.gmail.com> <427F8321.5030702@samurai.com> <20050509163423.GH35026@decibel.org> <427F9211.2090008@samurai.com> <20050509165133.GJ35026@decibel.org> <427FFCD3.1010803@samurai.com> <4407.1115698257@sss.pgh.pa.us> <428037A2.4060304@samurai.com> <6686.1115700888@sss.pgh.pa.us> <878y2nsj7i.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "10 May 2005 02:12:17 -0400" Date: Tue, 10 May 2005 09:53:18 -0400 Message-ID: <9871.1115733198@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/477 X-Sequence-Number: 77825 Greg Stark writes: > Tom Lane writes: >> I think that efficient implementation of this would require explicitly >> storing the hash code for each index entry, > It seems that means doubling the size of the hash index. That's a pretty big > i/o to cpu tradeoff. Hardly. The minimum possible size of a hash entry today is 8 bytes header plus 4 bytes datum, plus there's a 4-byte line pointer to factor in. So under the most pessimistic assumptions, storing the hash code would add 25% to the size. (On MAXALIGN=8 hardware, it might cost you nothing at all.) > What if the hash index stored *only* the hash code? That could be useful for > indexing large datatypes that would otherwise create large indexes. Hmm, that could be a thought. regards, tom lane