Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit28d8b42

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Speedup of PL/pgSQL by calling ExecEvalExpr() directly
instead of SPI_execp() for simple expressions.Jan
1 parentd611ccb commit28d8b42

File tree

5 files changed

+439
-117
lines changed

5 files changed

+439
-117
lines changed

‎src/backend/executor/spi.c

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,16 @@
33
* spi.c--
44
*Server Programming Interface
55
*
6-
* $Id: spi.c,v 1.31 1999/01/2700:36:21 tgl Exp $
6+
* $Id: spi.c,v 1.32 1999/01/2716:15:20 wieck Exp $
77
*
88
*-------------------------------------------------------------------------
99
*/
1010
#include"executor/spi.h"
11+
#include"executor/spi_priv.h"
1112
#include"catalog/pg_type.h"
1213
#include"access/printtup.h"
1314
#include"fmgr.h"
1415

15-
typedefstruct
16-
{
17-
QueryTreeList*qtlist;/* malloced */
18-
uint32processed;/* by Executor */
19-
SPITupleTable*tuptable;
20-
Portalportal;/* portal per procedure */
21-
MemoryContextsavedcxt;
22-
CommandIdsavedId;
23-
}_SPI_connection;
24-
2516
staticPortal_SPI_portal= (Portal)NULL;
2617
static_SPI_connection*_SPI_stack=NULL;
2718
static_SPI_connection*_SPI_current=NULL;
@@ -32,24 +23,12 @@ uint32SPI_processed = 0;
3223
SPITupleTable*SPI_tuptable;
3324
intSPI_result;
3425

35-
typedefstruct
36-
{
37-
QueryTreeList*qtlist;
38-
List*ptlist;
39-
intnargs;
40-
Oid*argtypes;
41-
}_SPI_plan;
42-
4326
staticint_SPI_execute(char*src,inttcount,_SPI_plan*plan);
4427
staticint_SPI_pquery(QueryDesc*queryDesc,EState*state,inttcount);
4528

4629
staticint_SPI_execute_plan(_SPI_plan*plan,
4730
Datum*Values,char*Nulls,inttcount);
4831

49-
#define_SPI_CPLAN_CURCXT0
50-
#define_SPI_CPLAN_PROCXT1
51-
#define_SPI_CPLAN_TOPCXT2
52-
5332
static_SPI_plan*_SPI_copy_plan(_SPI_plan*plan,intlocation);
5433

5534
staticint_SPI_begin_call(boolexecmem);
@@ -178,6 +157,18 @@ SPI_finish()
178157

179158
}
180159

160+
void
161+
SPI_push(void)
162+
{
163+
_SPI_curid++;
164+
}
165+
166+
void
167+
SPI_pop(void)
168+
{
169+
_SPI_curid--;
170+
}
171+
181172
int
182173
SPI_exec(char*src,inttcount)
183174
{

‎src/include/executor/spi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ extern intSPI_result;
7272

7373
externintSPI_connect(void);
7474
externintSPI_finish(void);
75+
externvoidSPI_push(void);
76+
externvoidSPI_pop(void);
7577
externintSPI_exec(char*src,inttcount);
7678
externintSPI_execp(void*plan,Datum*values,char*Nulls,inttcount);
7779
externvoid*SPI_prepare(char*src,intnargs,Oid*argtypes);

‎src/include/executor/spi_priv.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* spi.c--
4+
*Server Programming Interface private declarations
5+
*
6+
* $Header: /cvsroot/pgsql/src/include/executor/spi_priv.h,v 1.1 1999/01/27 16:15:21 wieck Exp $
7+
*
8+
*-------------------------------------------------------------------------
9+
*/
10+
#ifndefSPI_PRIV_H
11+
#defineSPI_PRIV_H
12+
13+
#include"catalog/pg_type.h"
14+
#include"access/printtup.h"
15+
16+
typedefstruct
17+
{
18+
QueryTreeList*qtlist;/* malloced */
19+
uint32processed;/* by Executor */
20+
SPITupleTable*tuptable;
21+
Portalportal;/* portal per procedure */
22+
MemoryContextsavedcxt;
23+
CommandIdsavedId;
24+
}_SPI_connection;
25+
26+
typedefstruct
27+
{
28+
QueryTreeList*qtlist;
29+
List*ptlist;
30+
intnargs;
31+
Oid*argtypes;
32+
}_SPI_plan;
33+
34+
#define_SPI_CPLAN_CURCXT0
35+
#define_SPI_CPLAN_PROCXT1
36+
#define_SPI_CPLAN_TOPCXT2
37+
38+
#endif/* SPI_PRIV_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp