8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.161 2007/02/22 22:00:23 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.162 2007/04/21 06:18:52 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -196,29 +196,16 @@ set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, Index rti)
196
196
static void
197
197
set_plain_rel_pathlist (PlannerInfo * root , RelOptInfo * rel , RangeTblEntry * rte )
198
198
{
199
- /* Mark rel with estimated output rows, width, etc */
200
- set_baserel_size_estimates (root , rel );
201
-
202
- /* Test any partial indexes of rel for applicability */
203
- check_partial_indexes (root , rel );
204
-
205
- /*
206
- * Check to see if we can extract any restriction conditions from join
207
- * quals that are OR-of-AND structures. If so, add them to the rel's
208
- * restriction list, and recompute the size estimates.
209
- */
210
- if (create_or_index_quals (root , rel ))
211
- set_baserel_size_estimates (root , rel );
212
-
213
199
/*
214
200
* If we can prove we don't need to scan the rel via constraint exclusion,
215
201
* set up a single dummy path for it. (Rather than inventing a special
216
202
* "dummy" path type, we represent this as an AppendPath with no members.)
217
203
*/
218
204
if (relation_excluded_by_constraints (rel , rte ))
219
205
{
220
- /* Reset output-rows estimate to 0 */
206
+ /* Set dummy size estimates --- we leave attr_widths[] as zeroes */
221
207
rel -> rows = 0 ;
208
+ rel -> width = 0 ;
222
209
223
210
add_path (rel , (Path * ) create_append_path (rel , NIL ));
224
211
@@ -228,6 +215,20 @@ set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
228
215
return ;
229
216
}
230
217
218
+ /* Mark rel with estimated output rows, width, etc */
219
+ set_baserel_size_estimates (root , rel );
220
+
221
+ /* Test any partial indexes of rel for applicability */
222
+ check_partial_indexes (root , rel );
223
+
224
+ /*
225
+ * Check to see if we can extract any restriction conditions from join
226
+ * quals that are OR-of-AND structures. If so, add them to the rel's
227
+ * restriction list, and recompute the size estimates.
228
+ */
229
+ if (create_or_index_quals (root , rel ))
230
+ set_baserel_size_estimates (root , rel );
231
+
231
232
/*
232
233
* Generate paths and add them to the rel's pathlist.
233
234
*
@@ -369,7 +370,8 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
369
370
/*
370
371
* Propagate size information from the child back to the parent. For
371
372
* simplicity, we use the largest widths from any child as the parent
372
- * estimates.
373
+ * estimates. (If you want to change this, beware of child
374
+ * attr_widths[] entries that haven't been set and are still 0.)
373
375
*/
374
376
rel -> rows += childrel -> rows ;
375
377
if (childrel -> width > rel -> width )
0 commit comments