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 529DF9FA4E3 for ; Fri, 28 Jul 2006 14:17:35 -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 65846-07 for ; Fri, 28 Jul 2006 14:17:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 49D8D9FB1F2 for ; Fri, 28 Jul 2006 14:17:20 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 9B95056437; Fri, 28 Jul 2006 12:17:17 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Fri, 28 Jul 2006 12:17:14 -0500 Date: Fri, 28 Jul 2006 12:17:14 -0500 From: "Jim C. Nasby" To: Jie Zhang Cc: Tom Lane , Mark Kirkwood , Josh Berkus , Gavin Sherry , pgsql-hackers@postgresql.org, Luke Lonergan Subject: Re: On-disk bitmap index patch Message-ID: <20060728171714.GR66525@pervasive.com> References: <748.1153983035@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060728:jzhang@greenplum.com::G4YxAOghzJ+ZJKbE:00000000000000000 0000000000000000000000000vMf X-Hashcash: 1:20:060728:tgl@sss.pgh.pa.us::5ozPU5kX2bcEvqvp:00000000000000000000 00000000000000000000000031Q5 X-Hashcash: 1:20:060728:markir@paradise.net.nz::WE/b/+5Pj0uORrB9:000000000000000 0000000000000000000000001XfW X-Hashcash: 1:20:060728:josh@agliodbs.com::lzisEvYfabv6ie20:00000000000000000000 000000000000000000000000GPo7 X-Hashcash: 1:20:060728:swm@linuxworld.com.au::M/dE0OrZkCvAvae0:0000000000000000 000000000000000000000000BxtP X-Hashcash: 1:20:060728:pgsql-hackers@postgresql.org::HFQH93vK7XkL0Kmc:000000000 0000000000000000000000000Lun X-Hashcash: 1:20:060728:llonergan@greenplum.com::kynSUaH/R9WQHVTL:00000000000000 0000000000000000000000004422 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200607/1458 X-Sequence-Number: 87313 On Thu, Jul 27, 2006 at 09:13:21AM -0700, Jie Zhang wrote: > On 7/26/06 11:50 PM, "Tom Lane" wrote: > > "Jie Zhang" writes: > >> On 7/26/06 10:14 PM, "Tom Lane" wrote: > >>> ... A nonuniform distribution would probably mean that some > >>> of the bitmaps compress better-than-expected and others worse. I have > >>> no idea how to model that and guess what the overall result is ... > > > >> The paper "Optimizing Bitmap Indices With Efficient Compression" by Kesheng > >> Wu et al gave an approximate answer for this question. Assume that there are > >> c distinct values. Let the i-th value has a probability of p_i, the number > >> of rows r, and the word size w. then the total size of the compressed bitmap > >> index is about (N/(w-1))(c- \sum(1-p_i)^(2w-2) - \sum(p_i)^(2w-2)), where in > >> both \sum's, i is from 1 to c. > > > > Hm, but that's still begging the question no? It's still assuming that > > any one value is uniformly distributed. ISTM the cases that would break > > my simplistic calculation involve clustering of particular values, such > > that some areas of the bitmap are all-zero while other areas have lots > > of ones. > > Yes, you are right -- each value is still uniformly distributed. But this > will be the worst case in terms of the size of a bitmap vector. As for how > to model the size of a bitmap vector for an non-uniformly distributed value, > that's a good question. I don't really know. But we do know the best case > and the worse case. If the usefulness of bitmap indexes is still in doubt, could someone at Greenplum provide data from actual data warehouses from actual customers? -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461