|
144 | 144 | #include"utils/fmgroids.h" |
145 | 145 | #include"utils/snapmgr.h" |
146 | 146 |
|
| 147 | +#include"machine_learning.h" |
147 | 148 |
|
148 | 149 | /* Check PostgreSQL version (9.6.0 contains important changes in planner) */ |
149 | 150 | #ifPG_VERSION_NUM<90600 |
@@ -237,12 +238,6 @@ extern double auto_tuning_convergence_error; |
237 | 238 |
|
238 | 239 | /* Machine learning parameters */ |
239 | 240 |
|
240 | | -/* Max number of matrix rows - max number of possible neighbors. */ |
241 | | -#defineaqo_K(30) |
242 | | - |
243 | | -externconstdoubleobject_selection_prediction_threshold; |
244 | | -externconstdoubleobject_selection_threshold; |
245 | | -externconstdoublelearning_rate; |
246 | 241 | externintaqo_k; |
247 | 242 | externdoublelog_selectivity_lower_bound; |
248 | 243 |
|
@@ -285,17 +280,13 @@ extern bool find_query(uint64 qhash, QueryContextData *ctx); |
285 | 280 | externboolupdate_query(uint64qhash,uint64fhash, |
286 | 281 | boollearn_aqo,booluse_aqo,boolauto_tuning); |
287 | 282 | externbooladd_query_text(uint64query_hash,constchar*query_string); |
288 | | -externboolload_fss_ext(uint64fs,intfss, |
289 | | -intncols,double**matrix,double*targets,int*rows, |
| 283 | +externboolload_fss_ext(uint64fs,intfss,OkNNrdata*data, |
290 | 284 | List**relids,boolisSafe); |
291 | | -externboolload_fss(uint64fhash,intfss_hash, |
292 | | -intncols,double**matrix,double*targets,int*rows, |
293 | | -List**relids); |
294 | | -externboolupdate_fss_ext(uint64fhash,intfsshash,intnrows,intncols, |
295 | | -double**matrix,double*targets,List*relids, |
296 | | -boolisTimedOut); |
297 | | -externboolupdate_fss(uint64fhash,intfss_hash,intnrows,intncols, |
298 | | -double**matrix,double*targets,List*relids); |
| 285 | +externboolload_fss(uint64fhash,intfss_hash,OkNNrdata*data,List**relids); |
| 286 | +externboolupdate_fss_ext(uint64fhash,intfsshash,OkNNrdata*data, |
| 287 | +List*relids,boolisTimedOut); |
| 288 | +externboolupdate_fss(uint64fhash,intfss_hash,OkNNrdata*data, |
| 289 | +List*relids); |
299 | 290 | QueryStat*get_aqo_stat(uint64query_hash); |
300 | 291 | voidupdate_aqo_stat(uint64query_hash,QueryStat*stat); |
301 | 292 | externboolmy_index_insert(RelationindexRelation,Datum*values,bool*isnull, |
@@ -324,14 +315,6 @@ void aqo_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, |
324 | 315 | uint64count,boolexecute_once); |
325 | 316 | voidaqo_ExecutorEnd(QueryDesc*queryDesc); |
326 | 317 |
|
327 | | -/* Machine learning techniques */ |
328 | | -externdoubleOkNNr_predict(intnrows,intncols, |
329 | | -double**matrix,constdouble*targets, |
330 | | -double*features); |
331 | | -externintOkNNr_learn(intmatrix_rows,intmatrix_cols, |
332 | | -double**matrix,double*targets, |
333 | | -double*features,doubletarget); |
334 | | - |
335 | 318 | /* Automatic query tuning */ |
336 | 319 | externvoidautomatical_query_tuning(uint64query_hash,QueryStat*stat); |
337 | 320 |
|
|