From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Chapman Flack <jcflack(at)acm(dot)org> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Subject: | Re: transforms [was Re: FmgrInfo allocation patterns (and PL handling as staged programming)] |
Date: | 2025-04-16 03:39:19 |
Message-ID: | 1826853.1744774759@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Chapman Flack <jcflack(at)acm(dot)org> writes:
> On 04/15/25 10:52, Tom Lane wrote:
>> The problem from a PL's standpoint is "given this input or output
>> of type FOO, should I transform it, and if so using what?". So
>> the starting point has to be a type not a transform.
> Perhaps the efficiency argument is really "say a function has
> a list of 100 arguments and only one is of type foo, how many cycles
> are wasted in get_transform_tosql and get_transform_fromsql applied
> to all those other types?"
That, and also "how many cycles are wasted in get_transform_tosql and
get_transform_fromsql when there isn't any TRANSFORM clause at all?"
> If pg_proc had protransforms instead, that would add a step zero: looking
> up the declared transforms to make an in-memory list of (typid, tosqloid,
> fromsqloid). After that, get_transform_{tosql,fromsql} would be applied
> and return quickly when the passed typid isn't in that list.
I don't doubt there are other ways that this could be built. But
you've not really made the case that another way is better (let alone
enough better to be worth breaking backward compatibility for).
I think the "normal" case is that there isn't any TRANSFORM clause.
As long as that case falls through quickly, it's hard to credit that
there's any meaningful performance difference between different
arrangements here.
My own beef with the whole setup is that you can't specify *which*
arguments or results you want transformed. I don't believe that
this should have been keyed off data types to begin with. But
that design was the SQL committee's choice so we're stuck ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Lakhin | 2025-04-16 04:00:01 | Re: recoveryCheck test failure on flaviventris |
Previous Message | jian he | 2025-04-16 03:16:32 | Re: pg_dump --if-exists --clean when drop index that is partition of a partitioned index |