Re: Found small issue with OUT params

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Mike Rylander <mrylander(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Found small issue with OUT params
Date: 2005-09-30 15:49:53
Message-ID: 20050930154951.GB29738@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 30, 2005 at 10:20:34AM -0500, Tony Caduto wrote:
> Tom,
> I hardly think the overhead would be significant on modern processors, I
> don't think the majority of users are running on Pentium 90s.( I am
> assuming you mean a performance overhead)

Um, please read the documention. Returning a tuple is *significantly*
more expensive than returning a single value. You have to get the tuple
descriptor, allocate memory for the tuple, fill in all the fields with
your data... For a single value you just return it.

See here for all the details, you really don't want to do it if you
don't need to.

http://www.postgresql.org/docs/8.0/interactive/xfunc-c.html#AEN30497

Now, you could fudge the parser to automatically alter the name of the
value in the function but I'm have no idea how hard that would be...
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Hallgren 2005-09-30 16:12:03 Re: Socket problem using beta2 on Windows-XP
Previous Message Tony Caduto 2005-09-30 15:20:34 Re: Found small issue with OUT params