1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-22 12:22:45 +03:00

Reimplement nodeMaterial to use a temporary BufFile (or even memory, if the

materialized tupleset is small enough) instead of a temporary relation.
This was something I was thinking of doing anyway for performance, and Jan
says he needs it for TOAST because he doesn't want to cope with toasting
noname relations.  With this change, the 'noname table' support in heap.c
is dead code, and I have accordingly removed it.  Also clean up 'noname'
plan handling in planner --- nonames are either sort or materialize plans,
and it seems less confusing to handle them separately under those names.
This commit is contained in:
Tom Lane
2000-06-18 22:44:35 +00:00
parent 2c0edb3c86
commit 1ee26b7764
32 changed files with 1090 additions and 982 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: execnodes.h,v 1.41 2000/04/12 17:16:39 momjian Exp $
* $Id: execnodes.h,v 1.42 2000/06/18 22:44:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -565,11 +565,9 @@ typedef struct HashJoinState
* MaterialState information
*
* materialize nodes are used to materialize the results
* of a subplan into a temporary relation.
* of a subplan into a temporary file.
*
* Flag indicated whether subplan has been materialized
* TempRelation temporary relation containing result of executing
* the subplan.
* tuplestorestate private state of tuplestore.c
*
* CommonScanState information
*
@@ -590,8 +588,7 @@ typedef struct HashJoinState
typedef struct MaterialState
{
CommonScanState csstate; /* its first field is NodeTag */
bool mat_Flag;
Relation mat_TempRelation;
void *tuplestorestate;
} MaterialState;
/* ---------------------

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: nodes.h,v 1.68 2000/05/29 01:59:12 tgl Exp $
* $Id: nodes.h,v 1.69 2000/06/18 22:44:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,13 +39,13 @@ typedef enum NodeTag
T_NestLoop,
T_MergeJoin,
T_HashJoin,
T_Noname,
T_Noname_XXX, /* not used anymore; this tag# is available */
T_Material,
T_Sort,
T_Agg,
T_Unique,
T_Hash,
T_Choose,
T_Choose_XXX, /* not used anymore; this tag# is available */
T_Group,
T_SubPlan,
T_TidScan,
@@ -261,10 +261,6 @@ typedef struct Node
(IsA(jp, Join) || IsA(jp, NestLoop) || \
IsA(jp, MergeJoin) || IsA(jp, HashJoin))
#define IsA_Noname(t) \
(IsA(t, Noname) || IsA(t, Material) || IsA(t, Sort) || \
IsA(t, Unique))
#define IsA_Value(t) \
(IsA(t, Integer) || IsA(t, Float) || IsA(t, String))

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: plannodes.h,v 1.39 2000/04/12 17:16:40 momjian Exp $
* $Id: plannodes.h,v 1.40 2000/06/18 22:44:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -277,27 +277,13 @@ typedef struct Group
GroupState *grpstate;
} Group;
/*
* ==========
* Noname nodes
* ==========
*/
typedef struct Noname
{
Plan plan;
Oid nonameid;
int keycount;
} Noname;
/* ----------------
* materialization node
* ----------------
*/
typedef struct Material
{
Plan plan; /* noname node flattened out */
Oid nonameid;
int keycount;
Plan plan;
MaterialState *matstate;
} Material;
@@ -307,8 +293,7 @@ typedef struct Material
*/
typedef struct Sort
{
Plan plan; /* noname node flattened out */
Oid nonameid;
Plan plan;
int keycount;
SortState *sortstate;
} Sort;
@@ -319,9 +304,7 @@ typedef struct Sort
*/
typedef struct Unique
{
Plan plan; /* noname node flattened out */
Oid nonameid;
int keycount;
Plan plan;
int numCols; /* number of columns to check for
* uniqueness */
AttrNumber *uniqColIdx; /* indexes into the target list */