pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
using of select (myfunction()).* is so slow
5+ messages / 2 participants
[nested] [flat]

* using of select (myfunction()).* is so slow
@ 2011-02-03 18:40  Gerardo Herzig <gherzig@fmed.uba.ar>
  0 siblings, 1 reply; 5+ messages in thread

From: Gerardo Herzig @ 2011-02-03 18:40 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: using of select (myfunction()).* is so slow
@ 2011-02-03 19:47  Pavel Stehule <pavel.stehule@gmail.com>
  parent: Gerardo Herzig <gherzig@fmed.uba.ar>
  0 siblings, 1 reply; 5+ messages in thread

From: Pavel Stehule @ 2011-02-03 19:47 UTC (permalink / raw)
  To: Gerardo Herzig <gherzig@fmed.uba.ar>; +Cc: pgsql-sql

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
>



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: using of select (myfunction()).* is so slow
@ 2011-02-04 10:51  Gerardo Herzig <gherzig@fmed.uba.ar>
  parent: Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Gerardo Herzig @ 2011-02-04 10:51 UTC (permalink / raw)
  To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: using of select (myfunction()).* is so slow
@ 2011-02-04 11:17  Pavel Stehule <pavel.stehule@gmail.com>
  parent: Gerardo Herzig <gherzig@fmed.uba.ar>
  0 siblings, 1 reply; 5+ messages in thread

From: Pavel Stehule @ 2011-02-04 11:17 UTC (permalink / raw)
  To: Gerardo Herzig <gherzig@fmed.uba.ar>; +Cc: pgsql-sql

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

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

regards

Pavel Stehule

> Gerardo
>
>



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: using of select (myfunction()).* is so slow
@ 2011-02-04 12:05  Gerardo Herzig <gherzig@fmed.uba.ar>
  parent: Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Gerardo Herzig @ 2011-02-04 12:05 UTC (permalink / raw)
  To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2011-02-04 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-03 18:40 using of select (myfunction()).* is so slow Gerardo Herzig <gherzig@fmed.uba.ar>
2011-02-03 19:47 ` Pavel Stehule <pavel.stehule@gmail.com>
2011-02-04 10:51   ` Gerardo Herzig <gherzig@fmed.uba.ar>
2011-02-04 11:17     ` Pavel Stehule <pavel.stehule@gmail.com>
2011-02-04 12:05       ` Gerardo Herzig <gherzig@fmed.uba.ar>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox