Re: [HACKERS] PL/pgSQL and SPI - Mailing list pgsql-hackers

From Vadim Mikheev
Subject Re: [HACKERS] PL/pgSQL and SPI
Date
Msg-id 36AF84BD.2E216570@krs.ru
Whole thread Raw
In response to PL/pgSQL and SPI  (jwieck@debis.com (Jan Wieck))
Responses Re: [HACKERS] PL/pgSQL and SPI
List pgsql-hackers
Jan Wieck wrote:
> 
>     1.  I've  just committed some changes to PL/pgSQL and the SPI
>         manager.
> 
>         It's  a  speedup  of  PL/pgSQL   execution   by   calling
>         ExecEvalExpr()   in  the  executor  directly  for  simple
>         expressions that return one single Datum.
> 
...
> 
>         To be able to do so I've moved some of  the  declarations
>         from  spi.c  into  a new header spi_priv.h so someone has
>         access to the  _SPI_plan  structure  for  past  preparing
>         plan-/querytree   analysis.  And  I've  added  two  silly
>         functions   SPI_push()   and   SPI_pop()   that    simply
>         increment/decrement   the   _SPI_curid   value.  This  is
>         required for calling ExecEvalExpr(), because there  could
>         be   functions   evaluated  that  use  SPI  themself  and
>         otherwise they could not connect to the SPI manager. They
>         are  dangerous  and  I'm  in  doubt if we should document
>         them.

BTW, Jan, did you consider ability to add new function
for fast expression evaluation to SPI itself and than just
use this func in PL/pgSQL?
This function seems to be generally usefull.
And we could avoid SPI_push/SPI_pop...

Vadim


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Something wacko about EXPLAIN cost stats
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Another speedup idea (two, even)