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 36CBB9FA6B2 for ; Tue, 25 Jul 2006 00:55:10 -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 01286-01 for ; Tue, 25 Jul 2006 00:55:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [203.96.152.181]) by postgresql.org (Postfix) with ESMTP id 4CC729FA4AA for ; Tue, 25 Jul 2006 00:55:03 -0300 (ADT) Received: from smtp-3.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0J2X00B6PXJPJX@linda-2.paradise.net.nz> for pgsql-hackers@postgresql.org; Tue, 25 Jul 2006 15:55:01 +1200 (NZST) Received: from [192.168.1.11] (218-101-29-211.dsl.clear.net.nz [218.101.29.211]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 8D7D7588430; Tue, 25 Jul 2006 15:55:00 +1200 (NZST) Date: Tue, 25 Jul 2006 15:54:48 +1200 From: Mark Kirkwood Subject: Re: On-disk bitmap index patch In-reply-to: To: Jie Zhang Cc: Hannu Krosing , Tom Lane , Gavin Sherry , pgsql-hackers@postgresql.org, Luke Lonergan Message-id: <44C59608.6030207@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 1.5.0.4 (X11/20060704) References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200607/1115 X-Sequence-Number: 86970 Jie Zhang wrote: > > On 7/24/06 6:59 AM, "Hannu Krosing" wrote: > >> >> >> And also for AND-s of several indexes, where indexes are BIG, your btree >> indexes may be almost as big as tables but the resulting set of pages is >> small. > > Yeah, Hannu points it out very well -- the bitmap index works very well when > columns have low cardinalities and AND operations will produce small number > of results. > > Also, the bitmap index is very small in low cardinality cases, where the > btree tends to take up at least 10 times more space. > > The smallness of the bitmap index also means that some queries will require much less work_mem to achieve good performance e.g consider: TPCH dataset with scale factor 10 on my usual PIII HW, query - select count(*) from lineitem where l_linenumber=1; This executes in about 100 seconds with work_mem = 20M if there is a bitmap index on l_linenumber. It takes 3832 seconds (!) if there is a btree index on the same column. Obviously cranking up work_mem will even up the difference (200M gets the btree to about 110 seconds), but being able to get good performance with less memory is a good thing! Cheers Mark