Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VgWwx-0006qK-Kf for pgsql-performance@arkaria.postgresql.org; Wed, 13 Nov 2013 09:41:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VgWwx-00059u-3a for pgsql-performance@arkaria.postgresql.org; Wed, 13 Nov 2013 09:41:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VgWwv-00058I-Dp for pgsql-performance@postgresql.org; Wed, 13 Nov 2013 09:41:25 +0000 Received: from mout.gmx.net ([212.227.15.15]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VgWwo-0007jo-K0 for pgsql-performance@postgresql.org; Wed, 13 Nov 2013 09:41:25 +0000 Received: from calvados.home ([91.89.70.247]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MIQlv-1Vj0BX2pLz-004GEW for ; Wed, 13 Nov 2013 10:41:16 +0100 Message-ID: <5283486A.7000209@gmx.net> Date: Wed, 13 Nov 2013 10:37:46 +0100 From: =?ISO-8859-1?Q?Torsten_F=F6rtsch?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: monalee_dba , pgsql-performance@postgresql.org Subject: Re: BitMap Heap Scan & BitMap Index Scan References: <1384068734255-5777632.post@n5.nabble.com> In-Reply-To: <1384068734255-5777632.post@n5.nabble.com> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:JhK/1ovjdYWnREdSs5C3VffMYcKDEnhgfFtQEOoAoPdI7a/nx3i UkoXuTfN52JzpETlAGOubcEYwIP5mt3mnTK2w3L0aPAEhAfi8se/BHqucbJCk3+yLBnpy1Q fBhFyI3g3qh2Su2RT2BANQf2kcFXq+uUaXQZxg9UUN6LHMF3EAwIVjVXcgMfo5hipkJ3gfb rECbsu/EX9WLN9ubI2Kyw== X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 10/11/13 08:32, monalee_dba wrote: > I would like to know, What is BitMap Heap Scan & BitMap Index Scan? When > I use EXPLAIN for query, which has LEFT JOIN with 4 different table then > some time query planner uses Bitmap Heap Scan and some time Bitmap Index > Scan? Check out this great presentation: http://momjian.us/main/writings/pgsql/optimizer.pdf The way I understand it is this (Correct me if I am wrong). The bitmap index scan uses an index to build a bitmap where each bit corresponds to a data buffer (8k). Since a buffer can contain multiple tuples and not all of them must match the condition another run over the heap pages is needed to find the matching tuples. This is the bitmap heap scan. It iterates over the table data buffers found in the bitmap index scan and selects only those tuples that match the filter (hence the recheck thing you see in explain) and visibility conditions. Torsten -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance