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

Commitfecb2b0

Browse files
committed
Minor code cleanup in optimizer.
1 parentf2ed835 commitfecb2b0

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.18 1999/02/15 01:06:57 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.19 1999/05/16 19:45:37 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -53,7 +53,7 @@ set_clause_selectivities(List *restrictinfo_list, Cost new_selectivity)
5353
{
5454
clausenode= (RestrictInfo*)lfirst(temp);
5555
cost_clause=clausenode->selectivity;
56-
if (FLOAT_IS_ZERO(cost_clause)||new_selectivity<cost_clause)
56+
if (cost_clause <=0||new_selectivity<cost_clause)
5757
clausenode->selectivity=new_selectivity;
5858
}
5959
}
@@ -129,7 +129,7 @@ set_rest_selec(Query *root, List *restrictinfo_list)
129129
* Check to see if the selectivity of this clause or any 'or'
130130
* subclauses (if any) haven't been set yet.
131131
*/
132-
if (valid_or_clause(clausenode)||FLOAT_IS_ZERO(cost_clause))
132+
if (cost_clause <=0||valid_or_clause(clausenode))
133133
{
134134
clausenode->selectivity=compute_clause_selec(root,
135135
(Node*)clausenode->clause,

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

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.34 1999/05/01 19:47:42 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.35 1999/05/16 19:45:37 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -418,29 +418,21 @@ match_unsorted_inner(RelOptInfo *joinrel,
418418
List*innerpath_list,
419419
List*mergeinfo_list)
420420
{
421-
Path*innerpath= (Path*)NULL;
422421
List*mp_list=NIL;
423-
PathOrder*innerpath_ordering=NULL;
424-
Costtemp1=0.0;
425-
booltemp2= false;
426-
List*i=NIL;
422+
List*i;
427423

428424
foreach(i,innerpath_list)
429425
{
426+
Path*innerpath= (Path*)lfirst(i);
427+
PathOrder*innerpath_ordering=innerpath->pathorder;
430428
MergeInfo*xmergeinfo= (MergeInfo*)NULL;
431429
List*clauses=NIL;
432430
List*matchedJoinKeys=NIL;
433431
List*matchedJoinClauses=NIL;
434432

435-
innerpath= (Path*)lfirst(i);
436-
437-
innerpath_ordering=innerpath->pathorder;
438-
439433
if (innerpath_ordering)
440-
{
441434
xmergeinfo=match_order_mergeinfo(innerpath_ordering,
442-
mergeinfo_list);
443-
}
435+
mergeinfo_list);
444436

445437
if (xmergeinfo)
446438
clauses= ((JoinMethod*)xmergeinfo)->clauses;
@@ -463,13 +455,13 @@ match_unsorted_inner(RelOptInfo *joinrel,
463455
*/
464456
if (clauses&&matchedJoinKeys)
465457
{
458+
Costtemp1;
459+
466460
temp1=outerrel->cheapestpath->path_cost+
467461
cost_sort(matchedJoinKeys,outerrel->size,outerrel->width);
468462

469-
temp2= (bool) (FLOAT_IS_ZERO(innerpath->outerjoincost)
470-
|| (innerpath->outerjoincost>temp1));
471-
472-
if (temp2)
463+
if (innerpath->outerjoincost <=0/* unset? */
464+
||innerpath->outerjoincost>temp1)
473465
{
474466
List*outerkeys=make_pathkeys_from_joinkeys(matchedJoinKeys,
475467
outerrel->targetlist,
@@ -494,8 +486,8 @@ match_unsorted_inner(RelOptInfo *joinrel,
494486
}
495487
}
496488
}
497-
returnmp_list;
498489

490+
returnmp_list;
499491
}
500492

501493
staticbool

‎src/include/optimizer/internal.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: internal.h,v 1.18 1999/03/07 12:00:38 momjian Exp $
9+
* $Id: internal.h,v 1.19 1999/05/16 19:45:36 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -27,7 +27,7 @@
2727
*System-dependent tuning constants
2828
*
2929
*/
30-
#define_CPU_PAGE_WEIGHT_ 0.033/* CPU-heap-to-page cost weighting factor */
30+
#define_CPU_PAGE_WEIGHT_ 0.033/* CPU-heap-to-page cost weighting factor */
3131
#define_CPU_INDEX_PAGE_WEIGHT_ 0.017/* CPU-index-to-page cost
3232
* weighting factor */
3333
#define_MAX_KEYS_ INDEX_MAX_KEYS/* maximum number of keys in an
@@ -64,7 +64,7 @@
6464
/* Identifier for invalid relation OIDs and attribute numbers for use by
6565
* selectivity functions
6666
*/
67-
#define_SELEC_VALUE_UNKNOWN_-1
67+
#define_SELEC_VALUE_UNKNOWN_(-1)
6868

6969
/* Flag indicating that a clause constant is really a parameter (or other
7070
*non-constant?), a non-parameter, or a constant on the right side
@@ -75,11 +75,6 @@
7575
#define_SELEC_CONSTANT_LEFT_ 0
7676
#define_SELEC_CONSTANT_RIGHT_ 2
7777

78-
#defineTOLERANCE 0.000001
79-
80-
#defineFLOAT_EQUAL(X,Y) ((X) - (Y) < TOLERANCE)
81-
#defineFLOAT_IS_ZERO(X) (FLOAT_EQUAL(X,0.0))
82-
8378
/* #define deactivate_joininfo(joininfo)joininfo->inactive=true*/
8479
/*#define joininfo_inactive(joininfo)joininfo->inactive */
8580

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp