| From: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
|---|---|
| To: | Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: cache type info in json_agg and friends |
| Date: | 2015-09-14 19:42:06 |
| Message-ID: | 55F7230E.3090804@sigaev.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> Currently, json_agg, jsonb_agg, json_object_agg and jsonb_object_agg do
> type classification on their arguments on each call to the transition
> function. This is quite unnecessary, as the argument types won't change.
> This patch remedies the defect by caching the necessary values in the
> aggregate state object.
+1
>
> While this doesn't change the performance much, since these functions
> are essentially dominated by other bits of the processing, I think it is
> nevertheless worth doing.
Agree
After quick observation of your patch, why don't you use FmgrInfo
instead of JsonAggState.val_output_func/JsonAggState.key_category?
FmgrInfo could be filled by fmgr_info_cxt() in aggcontext memory
context. Suppose, direct usage of FmgrInfo with FunctionCall a bit
faster than OidFunctionCall.
--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Dunstan | 2015-09-14 20:24:45 | Re: cache type info in json_agg and friends |
| Previous Message | Paul Jungwirth | 2015-09-14 19:41:35 | Re: Review: GiST support for UUIDs |