From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Tender Wang <tndrwang(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Alexander Lakhin <exclusion(at)gmail(dot)com> |
Subject: | Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build |
Date: | 2024-03-05 13:22:08 |
Message-ID: | CACJufxEQGsCqsa2XZMQdHtZxwBD8tncLDJV32+6G9y4bOi0jVg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, Mar 5, 2024 at 7:49 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
>
>>
>> On top of that, your approach has two bugs:
>> RelationGetIndexExpressions and RelationGetIndexPredicate would return
>> the flattened information if available directly from the relcache, so
>> even if you pass get_raw_expr=true you may finish with flattened
>> expressions and/or predicates, facing the same issues.
>>
>> I think that the correct way to do that would be to get the
>> information from the syscache when calculating the number of parallel
>> workers to use for the parallel index builds, with SysCacheGetAttr(),
>> for example. That would ensure that the expressions are not
>> flattened, letting the relcache be.
>
>
> I refactor the v2 version patch according to your advice.
> Any thoughts?
in RelationGetIndexClause to, I think you can use the following to
save a SearchSysCache1 cycle?
if (relation->rd_indextuple == NULL ||
heap_attisnull(relation->rd_indextuple, Anum_pg_index_indexprs, NULL))
return NIL;
or
if (relation->rd_indextuple == NULL ||
heap_attisnull(relation->rd_indextuple, Anum_pg_index_indpred, NULL))
return NIL;
main question would be why not two functions,
like RelationGetIndexRawExpr(Relation relation),
RelationGetIndexRawPred(Relation relation)
From | Date | Subject | |
---|---|---|---|
Next Message | Ronan Dunklau | 2024-03-05 13:34:21 | Re: FSM Corruption (was: Could not read block at end of the relation) |
Previous Message | Miron Berlin | 2024-03-05 12:15:26 | bug in function strtoint, on Windows OS won't report ERANGE |