Re: A little cosmetic to convert_VALUES_to_ANY()

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Tender Wang <tndrwang(at)gmail(dot)com>
Subject: Re: A little cosmetic to convert_VALUES_to_ANY()
Date: 2025-08-04 03:10:53
Message-ID: 175427705343.1031.14841847789593715999.pgcf@coridan.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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 for loop, 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 original code, it won't enter the for loop, nothing will be built; with this patch, operations have been performed on the first 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-08-04 03:15:59 Dead code with short varlenas in toast_save_datum()
Previous Message jian he 2025-08-04 03:10:06 Re: implement CAST(expr AS type FORMAT 'template')