Re: Extra cost of "lossy mode" Bitmap Scan plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: higepon <higepon(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Extra cost of "lossy mode" Bitmap Scan plan
Date: 2009-05-07 13:46:16
Message-ID: 16737.1241703976@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

higepon <higepon(at)gmail(dot)com> writes:
> But I don't understand this case.
> select * from emp where emp_no > 10000;
> Is Bitmap Scan is faster than Index Scan in this case ?

Yes, very probably, if a lot of tuples are being retrieved. A bitmap
scan will fetch the tuples from the heap in a more or less optimal
fashion --- for instance, each page is read only once. Index scan will
result in a random sequence of accesses to the heap. (Of course, it
might have some order if the index is well correlated with the heap
order, but most of the time that's not true.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2009-05-07 13:47:33 Re: create if not exists (CINE)
Previous Message Simon Riggs 2009-05-07 13:08:42 Re: BUG #4796: Recovery followed by backup creates unrecoverable WAL-file