Re: how do you call one pltcl function from another?

From: Jan Wieck <janwieck(at)Yahoo(dot)com>
To: Jonathan Ellis <jellis(at)advocast(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how do you call one pltcl function from another?
Date: 2000-11-09 14:22:34
Message-ID: 200011091422.JAA01249@jupiter.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Yahoo(dot)com #

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christian Fritze 2000-11-09 14:34:58 Maybe a strange question, but: "How long may a cursor live?"
Previous Message pgsql-general 2000-11-09 14:09:42 upgrading to 7.0.2