aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/pathnode.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-02-11 05:29:08 +0000
committerBruce Momjian <bruce@momjian.us>1999-02-11 05:29:08 +0000
commit129543e22d6ee79038ad91f649accf9856686d23 (patch)
tree99830df972e7842385997cd2ad17ab3f8d56c1a4 /src/backend/optimizer/util/pathnode.c
parentdbd80c97f4d04ddbe6f9208fcbd21d11a2b29e0f (diff)
downloadpostgresql-129543e22d6ee79038ad91f649accf9856686d23.tar.gz
postgresql-129543e22d6ee79038ad91f649accf9856686d23.zip
optimizer cleanup
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r--src/backend/optimizer/util/pathnode.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 02360d74f08..28ab4573741 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.24 1999/02/11 04:08:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.25 1999/02/11 05:29:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -195,14 +195,19 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
* more expensive and replace unordered path with ordered
* path if it is not more expensive.
*/
+
+ /* same keys, and new is cheaper, use it */
if ((longer_key == 0 && new_path->path_cost < path->path_cost) ||
- (longer_key == 1 && new_path->path_cost <= path->path_cost) ||
- (longer_key == 2 && new_path->path_cost >= path->path_cost))
+ /* new is longer, and cheaper, use it */
+ (longer_key == 1 && new_path->path_cost <= path->path_cost))
{
*is_new = false;
return new_path;
}
- else
+ /* same keys, new is more expensive, stop */
+ else if ((longer_key == 0 && new_path->path_cost >= path->path_cost) ||
+ /* old is longer, and less expensive, stop */
+ (longer_key == 2 && new_path->path_cost >= path->path_cost))
{
*is_new = false;
return NULL;