@@ -139,15 +139,12 @@ aqo_set_baserel_rows_estimate(PlannerInfo *root, RelOptInfo *rel)
139139List * restrict_clauses ;
140140int fss = 0 ;
141141
142- if (query_context .use_aqo || query_context . learn_aqo )
142+ if (query_context .use_aqo )
143143selectivities = get_selectivities (root ,rel -> baserestrictinfo ,0 ,
144144JOIN_INNER ,NULL );
145-
146- if (!query_context .use_aqo )
145+ else
147146{
148- if (query_context .learn_aqo )
149- list_free_deep (selectivities );
150-
147+ rel -> predicted_cardinality = -2. ;
151148call_default_set_baserel_rows_estimate (root ,rel );
152149return ;
153150}
@@ -207,7 +204,7 @@ aqo_get_parameterized_baserel_size(PlannerInfo *root,
207204int current_hash ;
208205int fss = 0 ;
209206
210- if (query_context .use_aqo || query_context . learn_aqo )
207+ if (query_context .use_aqo )
211208{
212209MemoryContext mcxt ;
213210
@@ -232,14 +229,9 @@ aqo_get_parameterized_baserel_size(PlannerInfo *root,
232229pfree (args_hash );
233230pfree (eclass_hash );
234231}
235-
236- if (!query_context .use_aqo )
232+ else
237233{
238- if (query_context .learn_aqo )
239- {
240- list_free_deep (selectivities );
241- list_free (allclauses );
242- }
234+ predicted_ppi_rows = -3. ;
243235return call_default_get_parameterized_baserel_size (root ,rel ,
244236param_clauses );
245237}
@@ -281,15 +273,12 @@ aqo_set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
281273List * current_selectivities = NULL ;
282274int fss = 0 ;
283275
284- if (query_context .use_aqo || query_context . learn_aqo )
276+ if (query_context .use_aqo )
285277current_selectivities = get_selectivities (root ,restrictlist ,0 ,
286278sjinfo -> jointype ,sjinfo );
287-
288- if (!query_context .use_aqo )
279+ else
289280{
290- if (query_context .learn_aqo )
291- list_free_deep (current_selectivities );
292-
281+ rel -> predicted_cardinality = -2. ;
293282call_default_set_joinrel_size_estimates (root ,rel ,
294283outer_rel ,
295284inner_rel ,
@@ -352,15 +341,12 @@ aqo_get_parameterized_joinrel_size(PlannerInfo *root,
352341List * current_selectivities = NULL ;
353342int fss = 0 ;
354343
355- if (query_context .use_aqo || query_context . learn_aqo )
344+ if (query_context .use_aqo )
356345current_selectivities = get_selectivities (root ,restrict_clauses ,0 ,
357346sjinfo -> jointype ,sjinfo );
358-
359- if (!query_context .use_aqo )
347+ else
360348{
361- if (query_context .learn_aqo )
362- list_free_deep (current_selectivities );
363-
349+ predicted_ppi_rows = -3. ;
364350return call_default_get_parameterized_joinrel_size (root ,rel ,
365351outer_path ,
366352inner_path ,