Re: BRIN INDEX value - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: BRIN INDEX value
Date
Msg-id 20150904.133331.812720785342174084.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: BRIN INDEX value  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: BRIN INDEX value  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Re: BRIN INDEX value  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
> On 9/4/2015 8:28 AM, Tatsuo Ishii wrote:
>>>
>>> Attached hack fixes the symptom but perhaps not the correct fix for this.
>> 
>> Why can't we fix summarize_range() in brin.c:
>> 
>>     IndexBuildHeapRangeScan(heapRel, state->bs_irel, indexInfo, false, true,
>>                             heapBlk, state->bs_pagesPerRange,
>>                             brinbuildCallback, (void *) state);
>> 
>> This currently thoughtlessly passes scannumblocks as
>> state->bs_pagesPerRange. Shouldn't we change this so that
>> (scanStartBlock + scanNumBlocks) does not exceed scan->rs_nblocks?
>> 
> 
> Ah, it did cross my mind to the fix it in brin.c but was not sure. I did
> it that way in the attached patch.

Amit,

I have looked into your patch and am a little bit worried because it
calls RelationGetNumberOfBlocks() which is an expensive function.
I think there are two ways to avoid it.

1) fall back to your former patch. However it may break existing  behavior what you said. I think there's very little
chanceit  actually happens because IndexBuildHeapRangeScan() is only used by  brin (I confirmed this). But Alvaro said
somepatches may be it's  customers. Robert, Amit, Can you please confirm this?
 

2) change the signature of IndexBuildHeapRangeScan() to be able to  teach it to limit the target block number to not
exceedthe last  page of the relation. Again this may break someone's patch and need  confirmation.
 

What do you think?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal: function parse_ident
Next
From: Amit Langote
Date:
Subject: Re: BRIN INDEX value