[pgpool-hackers: 3445] Re: [Proposal] using volatility categories to determine whether a function is read only or not
pengbo at sraoss.co.jp
Thu Sep 26 15:18:37 JST 2019
On Thu, 19 Sep 2019 09:23:47 +0900 (JST)
Tatsuo Ishii <ishii at sraoss.co.jp> wrote:
> Currently we determine whether a function is read only or not by using
> black_function_list/white_function_list. From the PostgreSQL manual
> "37.7. Function Volatility Categories":
> Any function with side-effects must be labeled VOLATILE, so
> that calls to it cannot be optimized away. Even a function with
> no side-effects needs to be labeled VOLATILE if its value can
> change within a single query; some examples are random(),
> currval(), timeofday().
> So it seems just check the volatility property of a function is enough
> to determine whether the function in question is a read only or not,
> and thus we could eliminate the use of
> black_function_list/white_function_list. As maintaining
> black_function_list/white_function_list is a major headache for users,
> I believe this change is good thing for them.
Yes. I agree.
Because write queries are not allowed in a non-volatile function,
I think just check the volatility property of a function is enough.
> To implement this, we would invent new bool parameter something like
> "auto_check_writing_function" and if it is true, check the volatility
> property in the system catalog to determine whether a function is
> going to write or not. If it's STABLE, or IMMUTABLE, we can assume the
> function is read only.
> If the parameter is off, we do the same thing as before: just
> consult black_function_list/white_function_list.
> The reason why we want to give a choice to uses is, looking into the
> system catalog gives overhead. Some users may dislike it.
Yes, we can add a new parameter to enbale this feature.
> Comments and suggestions are welcome.
> Best regards,
> Tatsuo Ishii
> SRA OSS, Inc. Japan
> English: http://www.sraoss.co.jp/index_en.php
> pgpool-hackers mailing list
> pgpool-hackers at pgpool.net
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS, Inc. Japan
More information about the pgpool-hackers