Re: A little cosmetic to convert_VALUES_to_ANY() - Mailing list pgsql-hackers

From Chao Li
Subject Re: A little cosmetic to convert_VALUES_to_ANY()
Date
Msg-id 175427705343.1031.14841847789593715999.pgcf@coridan.postgresql.org
Whole thread Raw
In response to Re: A little cosmetic to convert_VALUES_to_ANY()  (Tender Wang <tndrwang@gmail.com>)
Responses Re: A little cosmetic to convert_VALUES_to_ANY()
List pgsql-hackers
I tested this patch locally and it works for me.

However I doubt if it really improve performance. The original code "contain_volatile_functions((Node *)
rte->values_lists)"recursively work through rte-values_list, and this patch move contain_volatile_functions() into the
forloop, and checks against every item of rte->values_list. As entries of values_list could just be Const,
contain_volatile_functions()will then return immediately, so that this changes reduces total calls to
contain_volatile_functions().From this perspective, this patch may improve the performance.
 

On the other side, let's say a case where a values_list contains 10 items, and the last item is volatile. With the
originalcode, it won't enter the for loop, nothing will be built; with this patch, operations have been performed on
thefirst 9 items, but eventually it returns NULL when hit the last item. So in this case, performance could be worse.
 

Overall, I am afraid the burden could beat the gain.

The new status of this patch is: Waiting on Author

pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: implement CAST(expr AS type FORMAT 'template')
Next
From: Michael Paquier
Date:
Subject: Dead code with short varlenas in toast_save_datum()