Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion aqo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void _PG_init(void);
/* Strategy of determining feature space for new queries. */
int aqo_mode = AQO_MODE_CONTROLLED;
bool force_collect_stat;
bool aqo_predict_with_few_neighbors;

/*
* Show special info in EXPLAIN mode.
Expand Down Expand Up @@ -71,7 +72,7 @@ int auto_tuning_infinite_loop = 8;
/* Machine learning parameters */

/* The number of nearest neighbors which will be chosen for ML-operations */
int aqo_k = 3;
int aqo_k;
double log_selectivity_lower_bound = -30;

/*
Expand Down Expand Up @@ -293,6 +294,29 @@ _PG_init(void)
NULL
);

DefineCustomIntVariable("aqo.k_neighbors_threshold",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь те же вопросы, что и в #112
Ну и внимательнее смотреть в свои комменты, прогонять через проверку словаря, грамматики, может быть.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Параметр переименовала и добавила более понятные описания в них.
Ответила на вопросы в #112

"Set the threshold of number of neighbors for predicting.",
NULL,
&aqo_k,
3,
1, INT_MAX / 1000,
PGC_USERSET,
0,
NULL,
NULL,
NULL);

DefineCustomBoolVariable("aqo.predict_with_few_neighbors",
"Make prediction with less neighbors than we should have.",
NULL,
&aqo_predict_with_few_neighbors,
true,
PGC_USERSET,
0,
NULL,
lc_assign_hook,
NULL);

prev_shmem_startup_hook = shmem_startup_hook;
shmem_startup_hook = aqo_init_shmem;
prev_planner_hook = planner_hook;
Expand Down
1 change: 1 addition & 0 deletions aqo.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ extern double auto_tuning_convergence_error;
/* Machine learning parameters */

extern int aqo_k;
extern bool aqo_predict_with_few_neighbors;
extern double log_selectivity_lower_bound;

/* Parameters for current query */
Expand Down
2 changes: 1 addition & 1 deletion cardinality_estimation.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ predict_for_relation(List *clauses, List *selectivities, List *relsigns,
*/

/* Try to search in surrounding feature spaces for the same node */
if (!load_aqo_data(query_context.fspace_hash, *fss, data, NULL, use_wide_search))
if (!load_aqo_data(query_context.fspace_hash, *fss, data, NULL, use_wide_search, features))
result = -1;
else
{
Expand Down
Loading