77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.51 1999/07/24 23:21:08 tgl Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.52 1999/07/30 22:34:17 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -59,6 +59,9 @@ make_one_rel(Query *root, List *rels)
5959if (levels_needed <=0 )
6060return NULL ;
6161
62+ /*
63+ * Generate access paths for the base rels.
64+ */
6265set_base_rel_pathlist (root ,rels );
6366
6467if (levels_needed <=1 )
@@ -73,8 +76,10 @@ make_one_rel(Query *root, List *rels)
7376{
7477
7578/*
76- * This means that joins or sorts are required. set selectivities
77- * of clauses that have not been set by an index.
79+ * This means that joins or sorts are required. Set selectivities
80+ * of any clauses not yet set. (I think that this is redundant;
81+ * set_base_rel_pathlist should have set them all already. But
82+ * a scan to check that they are all set doesn't cost much...)
7883 */
7984set_rest_relselec (root ,rels );
8085
@@ -131,11 +136,15 @@ set_base_rel_pathlist(Query *root, List *rels)
131136
132137set_cheapest (rel ,rel -> pathlist );
133138
134- /*
135- *if there is a qualification ofsequential scan the selec. value
136- *is not set -- so set it explicitly -- Sunita
139+ /* Set the selectivity estimates for any restriction clauses that
140+ *didn't get set as a byproduct ofindex-path selectivity estimation
141+ *(see create_index_path()).
137142 */
138143set_rest_selec (root ,rel -> restrictinfo );
144+
145+ /* Calculate the estimated size (post-restrictions) and tuple width
146+ * for this base rel. This uses the restriction clause selectivities.
147+ */
139148rel -> size = compute_rel_size (rel );
140149rel -> width = compute_rel_width (rel );
141150}