Skip to content

Commit 6ee84f4

Browse files
funbringerdanolivo
authored andcommitted
instant minor fixes
1 parent 9771efe commit 6ee84f4

File tree

7 files changed

+23
-26
lines changed

7 files changed

+23
-26
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
results/*
2+
regression.diffs
3+
regression.out
4+
*.o
5+
*.so
6+
*.gcda
7+
*.gcno
8+
*.gcov
9+
tags

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ DATA = aqo--1.0.sql
77
OBJS = aqo.o auto_tuning.o cardinality_estimation.o cardinality_hooks.o \
88
hash.o machine_learning.o path_utils.o postprocessing.o preprocessing.o \
99
selectivity_cache.o storage.o utils.o $(WIN32RES)
10+
1011
REGRESS = aqo_disabled aqo_controlled aqo_intelligent aqo_forced aqo_learn
12+
EXTRA_REGRESS_OPTS=--temp-config=$(CURDIR)/conf.add
1113

1214
MODULE_big = aqo
1315
ifdef USE_PGXS

aqo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@
113113
#ifndef __ML_CARD_H__
114114
#define __ML_CARD_H__
115115

116+
#include <math.h>
117+
116118
#include "postgres.h"
117119

118120
#include "fmgr.h"

cardinality_estimation.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ predict_for_relation(List *restrict_clauses, List *selectivities, List *relids)
2323
double result;
2424
int rows;
2525
int i;
26-
ListCell *l;
2726

2827
get_fss_for_object(restrict_clauses, selectivities, relids,
2928
&nfeatures, &fss_hash, &features);
@@ -43,10 +42,8 @@ predict_for_relation(List *restrict_clauses, List *selectivities, List *relids)
4342
pfree(matrix[i]);
4443
pfree(matrix);
4544
pfree(target);
45+
list_free_deep(selectivities);
4646
list_free(restrict_clauses);
47-
foreach(l, selectivities)
48-
pfree(lfirst(l));
49-
list_free(selectivities);
5047
list_free(relids);
5148

5249
if (result < 0)

cardinality_hooks.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ aqo_set_baserel_rows_estimate(PlannerInfo *root, RelOptInfo *rel)
127127
Oid relid;
128128
List *relids;
129129
List *selectivities;
130-
ListCell *l;
131130

132131
if (use_aqo || learn_aqo)
133132
selectivities = get_selectivities(root, rel->baserestrictinfo, 0,
@@ -136,11 +135,8 @@ aqo_set_baserel_rows_estimate(PlannerInfo *root, RelOptInfo *rel)
136135
if (!use_aqo)
137136
{
138137
if (learn_aqo)
139-
{
140-
foreach(l, selectivities)
141-
pfree(lfirst(l));
142-
list_free(selectivities);
143-
}
138+
list_free_deep(selectivities);
139+
144140
call_default_set_baserel_rows_estimate(root, rel);
145141
return;
146142
}
@@ -207,9 +203,7 @@ aqo_get_parameterized_baserel_size(PlannerInfo *root,
207203
{
208204
if (learn_aqo)
209205
{
210-
foreach(l, selectivities)
211-
pfree(lfirst(l));
212-
list_free(selectivities);
206+
list_free_deep(selectivities);
213207
list_free(allclauses);
214208
}
215209
return call_default_get_parameterized_baserel_size(root, rel,
@@ -248,7 +242,6 @@ aqo_set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
248242
List *inner_selectivities;
249243
List *outer_selectivities;
250244
List *current_selectivities;
251-
ListCell *l;
252245

253246
if (use_aqo || learn_aqo)
254247
current_selectivities = get_selectivities(root, restrictlist, 0,
@@ -257,11 +250,8 @@ aqo_set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
257250
if (!use_aqo)
258251
{
259252
if (learn_aqo)
260-
{
261-
foreach(l, current_selectivities)
262-
pfree(lfirst(l));
263-
list_free(current_selectivities);
264-
}
253+
list_free_deep(current_selectivities);
254+
265255
call_default_set_joinrel_size_estimates(root, rel,
266256
outer_rel,
267257
inner_rel,
@@ -315,7 +305,6 @@ aqo_get_parameterized_joinrel_size(PlannerInfo *root,
315305
List *inner_selectivities;
316306
List *outer_selectivities;
317307
List *current_selectivities;
318-
ListCell *l;
319308

320309
if (use_aqo || learn_aqo)
321310
current_selectivities = get_selectivities(root, restrict_clauses, 0,
@@ -324,11 +313,8 @@ aqo_get_parameterized_joinrel_size(PlannerInfo *root,
324313
if (!use_aqo)
325314
{
326315
if (learn_aqo)
327-
{
328-
foreach(l, current_selectivities)
329-
pfree(lfirst(l));
330-
list_free(current_selectivities);
331-
}
316+
list_free_deep(current_selectivities);
317+
332318
return call_default_get_parameterized_joinrel_size(root, rel,
333319
outer_path,
334320
inner_path,

conf.add

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shared_preload_libraries = 'aqo'

storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ init_deactivated_queries_storage(void)
891891
deactivated_queries = hash_create("aqo_deactivated_queries",
892892
128, /* start small and extend */
893893
&hash_ctl,
894-
HASH_ELEM);
894+
HASH_ELEM | HASH_BLOBS);
895895
}
896896

897897
/* Destroys the storage for hash of deactivated queries */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy