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

Commite011459

Browse files
committed
Make set_function_size_estimates() marginally smarter: per original
comment, it can at least test whether the expression returns set.
1 parent93d358a commite011459

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎src/backend/optimizer/path/costsize.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* Portions Copyright (c) 1994, Regents of the University of California
5050
*
5151
* IDENTIFICATION
52-
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.147 2005/08/27 22:37:00 tgl Exp $
52+
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.148 2005/10/05 17:19:19 tgl Exp $
5353
*
5454
*-------------------------------------------------------------------------
5555
*/
@@ -1898,17 +1898,23 @@ join_in_selectivity(JoinPath *path, PlannerInfo *root)
18981898
void
18991899
set_function_size_estimates(PlannerInfo*root,RelOptInfo*rel)
19001900
{
1901+
RangeTblEntry*rte;
1902+
19011903
/* Should only be applied to base relations that are functions */
19021904
Assert(rel->relid>0);
1903-
Assert(rel->rtekind==RTE_FUNCTION);
1905+
rte=rt_fetch(rel->relid,root->parse->rtable);
1906+
Assert(rte->rtekind==RTE_FUNCTION);
19041907

19051908
/*
19061909
* Estimate number of rows the function itself will return.
19071910
*
1908-
* XXX no idea how to do this yet; butshould at least check whether
1911+
* XXX no idea how to do this yet; butwe can at least check whether
19091912
* function returns set or not...
19101913
*/
1911-
rel->tuples=1000;
1914+
if (expression_returns_set(rte->funcexpr))
1915+
rel->tuples=1000;
1916+
else
1917+
rel->tuples=1;
19121918

19131919
/* Now estimate number of output rows, etc */
19141920
set_baserel_size_estimates(root,rel);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp