pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Smet <guillaume.smet@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Question about Bitmap Heap Scan/BitmapAnd
Date: Tue, 13 Feb 2007 17:32:58 +0100
Message-ID: <1d4e0c10702130832i35484abfmb229f5d0b4d9223b@mail.gmail.com> (raw)

Hi all,

I'm currently working on optimizing a couple of queries. While
studying the EXPLAIN ANALYZE output of a query, I found this Bitmap
Heap Scan node:

->  Bitmap Heap Scan on lieu l  (cost=12.46..63.98 rows=53 width=94)
(actual time=35.569..97.166 rows=78 loops=1)
  Recheck Cond: ('(4190964.86112204, 170209.656489245,
4801644.52951672),(4194464.86111106, 173709.656478266,
4805144.52950574)'::cube @ (ll_to_earth((wgslat)::double precision,
(wgslon)::double precision))::cube)
  Filter: (parking AND (numlieu <> 0))
  ->  BitmapAnd  (cost=12.46..12.46 rows=26 width=0) (actual
time=32.902..32.902 rows=0 loops=1)
        ->  Bitmap Index Scan on idx_lieu_earth  (cost=0.00..3.38
rows=106 width=0) (actual time=30.221..30.221 rows=5864 loops=1)
              Index Cond: ('(4190964.86112204, 170209.656489245,
4801644.52951672),(4194464.86111106, 173709.656478266,
4805144.52950574)'::cube @ (ll_to_earth((wgslat)::double precision,
(wgslon)::double precision))::cube)
        ->  Bitmap Index Scan on idx_lieu_parking  (cost=0.00..8.83
rows=26404 width=0) (actual time=0.839..0.839 rows=1095 loops=1)
              Index Cond: (parking = true)

What surprises me is that "parking" is in the filter and not in the
Recheck Cond whereas it's part of the second Bitmap Index Scan of the
Bitmap And node.
AFAIK, BitmapAnd builds a bitmap of the pages returned by the two
Bitmap Index Scans so I supposed it should append both Index Cond in
the Recheck Cond.

Is there a reason why the second Index Cond in the filter? Does it
make a difference in terms of performance (I suppose no but I'd like
to have a confirmation)?

Thanks.

--
Guillaume



view thread (9+ messages)  latest in thread

Message-ID: <1d4e0c10702130832i35484abfmb229f5d0b4d9223b@mail.gmail.com>
Permalink:  ../1d4e0c10702130832i35484abfmb229f5d0b4d9223b@mail.gmail.com/
Also on:    postgresql.org/message-id/1d4e0c10702130832i35484abfmb229f5d0b4d9223b@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: guillaume.smet@gmail.com
  Subject: Re: Question about Bitmap Heap Scan/BitmapAnd
  In-Reply-To: <1d4e0c10702130832i35484abfmb229f5d0b4d9223b@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox