Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
1cffbfcb
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1cffbfcb
编写于
7月 27, 2000
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Arrange to free planning memory (or most of it, anyway) at completion
of planning. This should reduce memory requirements for large joins.
上级
c7793a73
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
5 deletion
+50
-5
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planmain.c
+50
-5
未找到文件。
src/backend/optimizer/plan/planmain.c
浏览文件 @
1cffbfcb
...
...
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.5
6 2000/07/24 03:11:01
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.5
7 2000/07/27 04:51:04
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -28,6 +28,7 @@
#include "optimizer/paths.h"
#include "optimizer/planmain.h"
#include "optimizer/tlist.h"
#include "utils/memutils.h"
static
Plan
*
subplanner
(
Query
*
root
,
List
*
flat_tlist
,
List
*
qual
,
...
...
@@ -176,6 +177,9 @@ subplanner(Query *root,
double
tuple_fraction
)
{
RelOptInfo
*
final_rel
;
Plan
*
resultplan
;
MemoryContext
mycontext
;
MemoryContext
oldcxt
;
Path
*
cheapestpath
;
Path
*
presortedpath
;
...
...
@@ -212,6 +216,24 @@ subplanner(Query *root,
*/
root
->
query_pathkeys
=
canonicalize_pathkeys
(
root
,
root
->
query_pathkeys
);
/*
* We might allocate quite a lot of storage during planning (due to
* constructing lots of Paths), but all of it can be reclaimed after
* we generate the finished Plan tree. Work in a temporary context
* to let that happen. We make the context a child of
* TransactionCommandContext so it will be freed if error abort.
*
* Note: beware of trying to move this up to the start of this routine.
* Some of the data structures built above --- notably the pathkey
* equivalence sets --- will still be needed after this routine exits.
*/
mycontext
=
AllocSetContextCreate
(
TransactionCommandContext
,
"Planner"
,
ALLOCSET_DEFAULT_MINSIZE
,
ALLOCSET_DEFAULT_INITSIZE
,
ALLOCSET_DEFAULT_MAXSIZE
);
oldcxt
=
MemoryContextSwitchTo
(
mycontext
);
/*
* Ready to do the primary planning.
*/
...
...
@@ -235,7 +257,9 @@ subplanner(Query *root,
root
->
query_pathkeys
=
NIL
;
/* signal unordered result */
/* Make childless Result node to evaluate given tlist. */
return
(
Plan
*
)
make_result
(
flat_tlist
,
(
Node
*
)
qual
,
(
Plan
*
)
NULL
);
resultplan
=
(
Plan
*
)
make_result
(
flat_tlist
,
(
Node
*
)
qual
,
(
Plan
*
)
NULL
);
goto
plan_built
;
}
#ifdef NOT_USED
/* fix xfunc */
...
...
@@ -295,7 +319,8 @@ subplanner(Query *root,
cheapestpath
->
pathkeys
))
{
root
->
query_pathkeys
=
cheapestpath
->
pathkeys
;
return
create_plan
(
root
,
cheapestpath
);
resultplan
=
create_plan
(
root
,
cheapestpath
);
goto
plan_built
;
}
/*
...
...
@@ -321,7 +346,8 @@ subplanner(Query *root,
{
/* Presorted path is cheaper, use it */
root
->
query_pathkeys
=
presortedpath
->
pathkeys
;
return
create_plan
(
root
,
presortedpath
);
resultplan
=
create_plan
(
root
,
presortedpath
);
goto
plan_built
;
}
/* otherwise, doing it the hard way is still cheaper */
}
...
...
@@ -334,5 +360,24 @@ subplanner(Query *root,
* as an aggregate function...)
*/
root
->
query_pathkeys
=
cheapestpath
->
pathkeys
;
return
create_plan
(
root
,
cheapestpath
);
resultplan
=
create_plan
(
root
,
cheapestpath
);
plan_built:
/*
* Must copy the completed plan tree and its pathkeys out of temporary
* context.
*/
MemoryContextSwitchTo
(
oldcxt
);
resultplan
=
copyObject
(
resultplan
);
root
->
query_pathkeys
=
copyObject
(
root
->
query_pathkeys
);
/*
* Now we can release the Path storage.
*/
MemoryContextDelete
(
mycontext
);
return
resultplan
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录