Re: type cache for concat functions

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: type cache for concat functions
Date: 2017-06-18 04:40:03
Message-ID: CAFj8pRDg9hqxhZfbmoZkC=1Y3qr5kc4ZX2hNp8qgfn4_yLnoqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-06-18 0:50 GMT+02:00 Dmitry Dolgov <9erthalion6(at)gmail(dot)com>:

> > On 20 May 2017 at 10:03, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> >
> > Now concat is 2x times slower than || operator. With cached FmgrInfo for
> > output function it will be only 5%.
>
> Looks nice and does what's expected (what else one may need from a Saturday
> evening). I just can mention that from what I see the previous version of
> `concat` is slower the more arguments are getting involved, so looks like
> it
> can be more than 2x.
>
> Also, it was a little bit confusing to see that the function `concat`
> behaves
> differently from operator `||` in terms of performance. When you're
> looking at
> the code it's becoming obvious, but I couldn't find any mention about that
> in
> the documentation.
>

There was few steps how to evaluate expressions more faster, but no step
how to evaluate faster polymorphic "any" functions. A detecting of used
argument type and looking to type cache are expensive. These functions was
designed for string processing in error messages, and the performance was
not too important. Now the concat function can be used often as replacement
of || operator when you do migration from Oracle due similar behave. And
the performance is more interesting now.

I think so can be interesting to allow some activity in analyzing/planning
time and prexec stage to user function developers. Some is possible via
planning time hooks, but for controlling few functions it is not user
friendly - and there are no space for data from this stages.

Regards

Pavel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2017-06-18 04:59:47 Re: logical replication - still unstable after all these months
Previous Message Thomas Munro 2017-06-18 03:58:43 Re: Decimal64 and Decimal128