1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Speedup of PL/pgSQL by calling ExecEvalExpr() directly

instead of SPI_execp() for simple expressions.

Jan
This commit is contained in:
Jan Wieck
1999-01-27 16:15:22 +00:00
parent d611ccb874
commit 28d8b42ca5
5 changed files with 439 additions and 117 deletions

View File

@ -3,25 +3,16 @@
* spi.c--
* Server Programming Interface
*
* $Id: spi.c,v 1.31 1999/01/27 00:36:21 tgl Exp $
* $Id: spi.c,v 1.32 1999/01/27 16:15:20 wieck Exp $
*
*-------------------------------------------------------------------------
*/
#include "executor/spi.h"
#include "executor/spi_priv.h"
#include "catalog/pg_type.h"
#include "access/printtup.h"
#include "fmgr.h"
typedef struct
{
QueryTreeList *qtlist; /* malloced */
uint32 processed; /* by Executor */
SPITupleTable *tuptable;
Portal portal; /* portal per procedure */
MemoryContext savedcxt;
CommandId savedId;
} _SPI_connection;
static Portal _SPI_portal = (Portal) NULL;
static _SPI_connection *_SPI_stack = NULL;
static _SPI_connection *_SPI_current = NULL;
@ -32,24 +23,12 @@ uint32 SPI_processed = 0;
SPITupleTable *SPI_tuptable;
int SPI_result;
typedef struct
{
QueryTreeList *qtlist;
List *ptlist;
int nargs;
Oid *argtypes;
} _SPI_plan;
static int _SPI_execute(char *src, int tcount, _SPI_plan *plan);
static int _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount);
static int _SPI_execute_plan(_SPI_plan *plan,
Datum *Values, char *Nulls, int tcount);
#define _SPI_CPLAN_CURCXT 0
#define _SPI_CPLAN_PROCXT 1
#define _SPI_CPLAN_TOPCXT 2
static _SPI_plan *_SPI_copy_plan(_SPI_plan *plan, int location);
static int _SPI_begin_call(bool execmem);
@ -178,6 +157,18 @@ SPI_finish()
}
void
SPI_push(void)
{
_SPI_curid++;
}
void
SPI_pop(void)
{
_SPI_curid--;
}
int
SPI_exec(char *src, int tcount)
{