pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sergei Shelukhin <realgeek@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: any way to get rid of Bitmap Heap Scan recheck?
Date: Sat, 19 May 2007 14:10:06 -0400
Message-ID: <14748.1179598206@sss.pgh.pa.us> (raw)
In-Reply-To: <1179380547.753418.193030@w5g2000hsg.googlegroups.com>
References: <1179380547.753418.193030@w5g2000hsg.googlegroups.com>

Sergei Shelukhin <realgeek@gmail.com> writes:
> The query is very slow (3 minutes on test data), here's what takes all
> the time, from explain results:

>> Bitmap Heap Scan on tag  (cost=897.06..345730.89 rows=115159 width=8)
>                            Recheck Cond: ((name)::text = 'blah'::text)
>                            ->  Bitmap Index Scan on tag_idxn
> (cost=0.00..897.06 rows=115159 width=0)
>                                  Index Cond: ((name)::text =
> 'blah'::text)

It's usually a good idea to do EXPLAIN ANALYZE on troublesome queries,
rather than trusting that the planner's estimates reflect reality.

> The query without recheck will run like up to 100 times faster
> according to overall query plan.

Sorry, but you have no concept what you're talking about.  The
difference between indexscan and heap scan estimates here reflects
fetching rows from the heap, not recheck costs.  Even if it were
a good idea to get rid of the recheck (which it is not), it wouldn't
reduce the costs materially.

If the table is fairly static then it might help to CLUSTER on that
index, so that the rows needed are brought together physically.

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <14748.1179598206@sss.pgh.pa.us>
Permalink:  ../14748.1179598206@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14748.1179598206@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, realgeek@gmail.com
  Subject: Re: any way to get rid of Bitmap Heap Scan recheck?
  In-Reply-To: <14748.1179598206@sss.pgh.pa.us>

* 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