On Thu, 27 May 2021 08:39:58 -0300, Adriano dos Santos Fernandes 
<adrian...@gmail.com> wrote:
> On 27/05/2021 04:29, Virgo Pärna via Firebird-devel wrote:
>> 
>>      At same time UDF is still faster than UDR/function. I did some
>
> UDR will always be slower than UDF, after all UDF is insecure (does not
> validate all things to be secure).
>
> But UDR could be improved. It has a thin layer AS PSQL functions, where
> it checks input and output parameters constraints and defaults.
>
> That layer, if implemented different, could make things faster than now.
>

        I understand. I just posted it to show, that UDF does still have
some advantages. And since UDF is still available in 4.0, then it is not
issue for when eventually switching tothat version. 

>>      Actually, one conversion could be done with:
>> CAST((CAST(FIELD_WITH_UTC_TIME||'UTC'  AS TIMESTAMP WITH TIME ZONE) AT 
>> LOCAL) AS
>> TIMESTAMP)
>> But it is ~4.5 times slower than UDF.
>> 
>
> You can SET TIME ZONE 'UTC';

        Maybe. I need to do comparisions in queries between date stored
to TIMESTAMP field bye local timezone and UTC timestamps (do those
timestamps fall into date period). And currently I'm using conversions
on both directions in same query. Although those can be rewritten so,
that only on type of conversion is used. And then there is always issue
of slowness of using this kind of CAST to convert. 

-- 
Virgo Pärna 
virgo.pa...@mail.ee



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to