Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5a3c113

Browse files
danolivoAndrey Lepikhov
authored and
Andrey Lepikhov
committed
Remove unneeded (I think so) calculation of
selectivities in the learning mode without using AQO. In this mode we aren't going to use any such data during a statistics gathering at the end of execution. Also add more safe initialization of a predicted cardinality field.
1 parent 1576416 commit 5a3c113

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

cardinality_hooks.c

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,12 @@ aqo_set_baserel_rows_estimate(PlannerInfo *root, RelOptInfo *rel)
139139
List *restrict_clauses;
140140
int fss = 0;
141141

142-
if (query_context.use_aqo || query_context.learn_aqo)
142+
if (query_context.use_aqo)
143143
selectivities = get_selectivities(root, rel->baserestrictinfo, 0,
144144
JOIN_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.;
151148
call_default_set_baserel_rows_estimate(root, rel);
152149
return;
153150
}
@@ -207,7 +204,7 @@ aqo_get_parameterized_baserel_size(PlannerInfo *root,
207204
int current_hash;
208205
int fss = 0;
209206

210-
if (query_context.use_aqo || query_context.learn_aqo)
207+
if (query_context.use_aqo)
211208
{
212209
MemoryContext mcxt;
213210

@@ -232,14 +229,9 @@ aqo_get_parameterized_baserel_size(PlannerInfo *root,
232229
pfree(args_hash);
233230
pfree(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.;
243235
return call_default_get_parameterized_baserel_size(root, rel,
244236
param_clauses);
245237
}
@@ -281,15 +273,12 @@ aqo_set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
281273
List *current_selectivities = NULL;
282274
int fss = 0;
283275

284-
if (query_context.use_aqo || query_context.learn_aqo)
276+
if (query_context.use_aqo)
285277
current_selectivities = get_selectivities(root, restrictlist, 0,
286278
sjinfo->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.;
293282
call_default_set_joinrel_size_estimates(root, rel,
294283
outer_rel,
295284
inner_rel,
@@ -352,15 +341,12 @@ aqo_get_parameterized_joinrel_size(PlannerInfo *root,
352341
List *current_selectivities = NULL;
353342
int fss = 0;
354343

355-
if (query_context.use_aqo || query_context.learn_aqo)
344+
if (query_context.use_aqo)
356345
current_selectivities = get_selectivities(root, restrict_clauses, 0,
357346
sjinfo->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.;
364350
return call_default_get_parameterized_joinrel_size(root, rel,
365351
outer_path,
366352
inner_path,

0 commit comments

Comments
 (0)