X-Original-To: pgsql-hackers-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id F28009FB1B8 for ; Thu, 27 Jul 2006 02:09:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 41387-02 for ; Thu, 27 Jul 2006 02:09:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by postgresql.org (Postfix) with ESMTP id 5CFC59FAD5A for ; Thu, 27 Jul 2006 02:09:49 -0300 (ADT) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Thu, 27 Jul 2006 01:09:36 -0400 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL05.Mi8.com ([172.16.1.189]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 27 Jul 2006 01:09:36 -0400 Received: from 71.146.16.17 ([71.146.16.17]) by MI8NYCMAIL05.Mi8.com ( [172.16.1.77]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Thu, 27 Jul 2006 05:09:35 +0000 User-Agent: Microsoft-Entourage/11.2.5.060620 Date: Wed, 26 Jul 2006 22:09:34 -0700 Subject: Re: On-disk bitmap index patch From: "Jie Zhang" To: "Luke Lonergan" , "Tom Lane" , "Mark Kirkwood" cc: "Josh Berkus" , "Gavin Sherry" , pgsql-hackers@postgresql.org Message-ID: Thread-Topic: [HACKERS] On-disk bitmap index patch Thread-Index: AcaxMIVTw+bUpB0jEdupjgAWy4o9DAAClQPv In-Reply-To: MIME-Version: 1.0 X-OriginalArrivalTime: 27 Jul 2006 05:09:36.0591 (UTC) FILETIME=[DAEE55F0:01C6B13A] X-WSS-ID: 68D6951A0VC181515-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.675 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_NUMERIC_HELO X-Spam-Level: * X-Archive-Number: 200607/1335 X-Sequence-Number: 87190 On 7/26/06 8:55 PM, "Luke Lonergan" wrote: > Tom, > > On 7/26/06 7:26 AM, "Tom Lane" wrote: > >> I wonder >> whether they oughtn't use 16-bit instead of 8-bit HRL_WORDs > > We tried variations from 8-bit to 32-bit and came to the conclusion that > 8-bit was a better match for the more general case. For the moment I forget > exactly why (maybe Jie or Ayush will recall). It's a #define I believe, so > you can play with it to find out. > > There's a lot more to be done with this - I think we've got some big gains > ahead. For low-cardinality cases, 8-bit word size is usually better than 16-bit and 32-bit. The reason is that in this case, the compression is better in 8-bit than in 16-bit or 32-bit. But for high-cardinality cases, like 10,000, 16-bit is better. That's because a compressed 8-bit can only represent at most 2^7*8=1024 bits. So every 10,000 bits requires about 10 bytes. However, a compressed 16-bit can represent 2^15*16=524288 bits. We only need 2 bytes. I have been thinking about this recently -- maybe we can support different word sizes for different cardinalities. > > BTW - lots of excitement here at OSCON about bitmap index, and there's a > fellow who is using the current Bizgres version, but wants *higher* > cardinality support, so I discussed Jie's thoughts about implementing > binning on values, basically combining bit vectors into value bins as the > cardinality increases. Yes, that's the basic idea. Essentially we want to limit the number of bins into an ideal value so that (1) the size of the bitmap index can be small; (2) this will still guarantee good query performance. The details still need to be working out. > > I am still puzzled why our index creation time increases so dramatically as > we approach cardinality 10,000. I know that we found that index page > traversal for append began to take a lot of time as we started to increase > the number of bitvector pages - we had talked about aggregating the append > operations into groups before they were implemented to sequentialize the > access. > I believe that this is because of 8-bit word size. We can try to increase it to 16-bit, and see how the result looks like. Thanks, Jie