Re: Parallel bitmap heap scan

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Rafia Sabih <rafia(dot)sabih(at)enterprisedb(dot)com>, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel bitmap heap scan
Date: 2017-03-07 16:14:48
Message-ID: CA+TgmoZeOUbvS4DTANFMP10HTJPDVpJYz87tx47td5ck+cRG1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 7, 2017 at 11:09 AM, Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> On Tue, Mar 7, 2017 at 9:34 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>
>> + if (DsaPointerIsValid(node->pstate->tbmiterator))
>> + tbm_free_shared_area(dsa, node->pstate->tbmiterator);
>> +
>> + if (DsaPointerIsValid(node->pstate->prefetch_iterator))
>> + dsa_free(dsa, node->pstate->prefetch_iterator);
>
> As per latest code, both should be calling to tbm_free_shared_area
> because tbm_free_shared_area is capable of handling that. My silly
> mistake. I will fix it.

Thanks. I don't think I believe this rationale:

+ /*
+ * If one of the process has already
identified that we need
+ * to do prefetch then let it perform
the prefetch and allow
+ * others to proceed with the work in
hand. Another option
+ * could be that we allow all of them
to participate in
+ * prefetching. But, most of this
work done under mutex or
+ * LWLock so ultimately we may end up
in prefetching
+ * sequentially.
+ */

I mean, IIUC, the call to PrefetchBuffer() is not done under any lock.
And that's the slow part. The tiny amount of time we spend updating
the prefetch information under the mutex should be insignificant
compared to the cost of actually reading the buffer. Unless I'm
missing something.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-03-07 16:16:29 Re: Automatic cleanup of oldest WAL segments with pg_receivexlog
Previous Message Robert Haas 2017-03-07 16:11:19 Re: Parallel bitmap heap scan