pgsql: Tweak order of operations in BitmapHeapNext() to avoid the case

Lists: pgsql-committerspgsql-hackers
From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Tweak order of operations in BitmapHeapNext() to avoid the case
Date: 2009-01-12 16:00:41
Message-ID: 20090112160041.DBA70754877@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Tweak order of operations in BitmapHeapNext() to avoid the case of prefetching
the same page we are nanoseconds away from reading for real. There should be
something left to do on the current page before we consider issuing a prefetch.

Modified Files:
--------------
pgsql/src/backend/executor:
nodeBitmapHeapscan.c (r1.33 -> r1.34)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeBitmapHeapscan.c?r1=1.33&r2=1.34)


From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: tgl(at)postgresql(dot)org (Tom Lane)
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgsql: Tweak order of operations in BitmapHeapNext() to avoid the case
Date: 2009-01-12 17:19:05
Message-ID: 87ab9wl9x2.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers


tgl(at)postgresql(dot)org (Tom Lane) writes:

> Log Message:
> -----------
> Tweak order of operations in BitmapHeapNext() to avoid the case of prefetching
> the same page we are nanoseconds away from reading for real. There should be
> something left to do on the current page before we consider issuing a prefetch.

Doesn't this break things if, say, there's precisely one tuple on every page?
You'll keep raising the prefetch_target but never actually prefetch anything.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgsql: Tweak order of operations in BitmapHeapNext() to avoid the case
Date: 2009-01-12 17:33:43
Message-ID: 2443.1231781623@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> tgl(at)postgresql(dot)org (Tom Lane) writes:
>> Tweak order of operations in BitmapHeapNext() to avoid the case of prefetching
>> the same page we are nanoseconds away from reading for real. There should be
>> something left to do on the current page before we consider issuing a prefetch.

> Doesn't this break things if, say, there's precisely one tuple on every page?

No. It'd only break things if there were zero tuples on each page, but
that's not possible (else the page wouldn't be in the index output to
begin with).

There is a bit of oddness in how fast the target ramps up, because of
the target++ in the "Continuing in previously obtained page" path.
I wasn't too happy with that target++ to begin with, but am not sure
what's a saner thing to do there.

regards, tom lane