Re: how do you call one pltcl function from another? - Mailing list pgsql-general

From Jan Wieck
Subject Re: how do you call one pltcl function from another?
Date
Msg-id 200011091422.JAA01249@jupiter.jw.home
Whole thread Raw
In response to Re: how do you call one pltcl function from another?  ("Jonathan Ellis" <jellis@advocast.com>)
List pgsql-general
Jonathan Ellis wrote:
> >     You need to call it via SPI like
> >
> >         spi_exec "select meta_class($1) as retval"
> >         return $retval
>
> What kind of performance hit is there doing this vs two plpgsql functions?
> IIANM, you're creating two separate tcl interpreters this way, which seems
> expensive.

    You  are  actually calling the same interpreter again through
    the SPI interface  (parser,  planner,  optimizer,  executor).
    Really expensive.

    Someone  can  skip  anything  but the executor by preparing a
    saved plan, but that's still a waste of  CPU.   At  the  very
    least,  calling  one  function from the other is expensive in
    any procedural language, that must  use  a  general  solution
    because the called function could be defined in any language.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



pgsql-general by date:

Previous
From: Denis Perchine
Date:
Subject: Re: TEXT and BLOBS
Next
From: "pgsql-general"
Date:
Subject: upgrading to 7.0.2