Обсуждение: using of select (myfunction()).* is so slow

Поиск
Список
Период
Сортировка

using of select (myfunction()).* is so slow

От
Gerardo Herzig
Дата:
Hi all, im using a function of my own in a subquery, and when wonderig
about the slowliness of this one, y relalize that:

test=# SELECT (_xxfunction(854,'711H',11,false)).* ;
(4 filas)
--Result DELETED
Duración: 1069,465 ms


glyms=# SELECT * from _xxfunction(854,'711H',11,false) ;
(4 filas)
Duración: 228,699 ms

For privacy reasons, i just deleted the result and the function name,
but the resulst are obviously exactly the same, and the ().* form (which
i needed) is taking so much more...there is a reason why? A workaround?

Thanks!

Gerardo



Re: using of select (myfunction()).* is so slow

От
Pavel Stehule
Дата:
Hello

If you use a record expansion over function's result, then function is
called once for record's field.

so don't do it on slow functions.

Regards

Pavel


2011/2/3 Gerardo Herzig <gherzig@fmed.uba.ar>:
> Hi all, im using a function of my own in a subquery, and when wonderig
> about the slowliness of this one, y relalize that:
>
> test=# SELECT (_xxfunction(854,'711H',11,false)).* ;
> (4 filas)
> --Result DELETED
> Duración: 1069,465 ms
>
>
> glyms=# SELECT * from _xxfunction(854,'711H',11,false) ;
> (4 filas)
> Duración: 228,699 ms
>
> For privacy reasons, i just deleted the result and the function name,
> but the resulst are obviously exactly the same, and the ().* form (which
> i needed) is taking so much more...there is a reason why? A workaround?
>
> Thanks!
>
> Gerardo
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>


Re: using of select (myfunction()).* is so slow

От
Gerardo Herzig
Дата:
El jue, 03-02-2011 a las 20:47 +0100, Pavel Stehule escribió:
> Hello
> 
> If you use a record expansion over function's result, then function is
> called once for record's field.
> 
> so don't do it on slow functions.
> 
> Regards
> 
> Pavel
> 
> 
> 2011/2/3 Gerardo Herzig <gherzig@fmed.uba.ar>:
> > Hi all, im using a function of my own in a subquery, and when wonderig
> > about the slowliness of this one, y relalize that:
> >
> > test=# SELECT (_xxfunction(854,'711H',11,false)).* ;
> > (4 filas)
> > --Result DELETED
> > Duración: 1069,465 ms
> >
> >
> > glyms=# SELECT * from _xxfunction(854,'711H',11,false) ;
> > (4 filas)
> > Duración: 228,699 ms
> >
> > For privacy reasons, i just deleted the result and the function name,
> > but the resulst are obviously exactly the same, and the ().* form (which
> > i needed) is taking so much more...there is a reason why? A workaround?
> >
> > Thanks!
> >
> > Gerardo
> >
> >
> > --
> > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-sql
> >
> 

Mmmmm ok Thanks...So there is no workaround/alternative to this?

Gerardo



Re: using of select (myfunction()).* is so slow

От
Pavel Stehule
Дата:
>>
>
> Mmmmm ok Thanks...So there is no workaround/alternative to this?
>

yes, (SELECT x.* from func(...) x) instead SELECT (func(...)).*

regards

Pavel Stehule

> Gerardo
>
>


Re: using of select (myfunction()).* is so slow

От
Gerardo Herzig
Дата:
El vie, 04-02-2011 a las 12:17 +0100, Pavel Stehule escribió:
> >>
> >
> > Mmmmm ok Thanks...So there is no workaround/alternative to this?
> >
> 
> yes, (SELECT x.* from func(...) x) instead SELECT (func(...)).*
> 
> regards
> 
> Pavel Stehule
> 
> > Gerardo
> >
> >
> 

Great, i will check that. Thanks again Pavel!

Gerardo