Re: type cache for concat functions

From: Alexander Kuzmenkov <a(dot)kuzmenkov(at)postgrespro(dot)ru>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: type cache for concat functions
Date: 2017-08-24 17:24:50
Message-ID: 748b7a45-b1b0-7a8d-719f-4d42a1645d50@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Pavel,

I tried applying your patch, it applies and compiles fine, check and
checkworld pass.

I ran a simple performance test, select
concat(generate_series(1,100000), ... [x5 total]) vs select
generate_series(1,100000)::text || ... .
Operator || runs in 60 ms, while unpatched concat takes 90 and patched
-- 55 ms.

About the code:
* There seems to be an extra tab here:
FmgrInfo *typcache;
It's not aligned with the previous declaration with tab size 4.

* You could allocate the cache and store it into the context inside
rebuildConcatCache. It would return return the cache pointer, and the
calling code would look cleaner -- just one line. This is a matter of
taste though.

* The nearby functions use snake_case, so it should be
rebuild_concat_cache too.

Overall the patch looks good to me.

--
Alexander Kuzmenkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Douglas Doole 2017-08-24 17:41:31 Re: [PATCH] Push limit to sort through a subquery
Previous Message Tom Lane 2017-08-24 17:24:15 Re: [PATCH] Push limit to sort through a subquery