132132#include "nodes/nodeFuncs.h"
133133#include "optimizer/pathnode.h"
134134#include "optimizer/planner.h"
135- #include "optimizer/cost.h"
136135#include "parser/analyze.h"
137136#include "parser/parsetree.h"
138137#include "utils/builtins.h"
139138#include "utils/guc.h"
140139#include "utils/hsearch.h"
141140#include "utils/memutils.h"
142141#include "utils/rel.h"
143- #include "utils/fmgroids.h"
144142#include "utils/snapmgr.h"
145143
146144#include "machine_learning.h"
147- //#include "storage.h"
148145
149146/* Check PostgreSQL version (9.6.0 contains important changes in planner) */
150147#if PG_VERSION_NUM < 90600
@@ -237,58 +234,15 @@ extern MemoryContext AQOCacheMemCtx;
237234extern MemoryContext AQOPredictMemCtx ;
238235extern MemoryContext AQOLearnMemCtx ;
239236
240- /* Saved hook values in case of unload */
241- extern post_parse_analyze_hook_type prev_post_parse_analyze_hook ;
242- extern planner_hook_type prev_planner_hook ;
243- extern ExecutorStart_hook_type prev_ExecutorStart_hook ;
244- extern ExecutorRun_hook_type prev_ExecutorRun ;
245- extern ExecutorEnd_hook_type prev_ExecutorEnd_hook ;
246- extern set_baserel_rows_estimate_hook_type
247- prev_set_foreign_rows_estimate_hook ;
248- extern set_baserel_rows_estimate_hook_type
249- prev_set_baserel_rows_estimate_hook ;
250- extern get_parameterized_baserel_size_hook_type
251- prev_get_parameterized_baserel_size_hook ;
252- extern set_joinrel_size_estimates_hook_type
253- prev_set_joinrel_size_estimates_hook ;
254- extern get_parameterized_joinrel_size_hook_type
255- prev_get_parameterized_joinrel_size_hook ;
256- extern ExplainOnePlan_hook_type prev_ExplainOnePlan_hook ;
257- extern ExplainOneNode_hook_type prev_ExplainOneNode_hook ;
258-
259- extern void ppi_hook (ParamPathInfo * ppi );
260237extern int aqo_statement_timeout ;
261238
262- /* Hash functions */
263- void get_eclasses (List * clauselist , int * nargs , int * * args_hash ,
264- int * * eclass_hash );
265- int get_clause_hash (Expr * clause , int nargs , int * args_hash , int * eclass_hash );
266-
267-
268- /* Storage interaction */
269- extern bool load_fss_ext (uint64 fs , int fss , OkNNrdata * data , List * * reloids );
270- extern bool update_fss_ext (uint64 fs , int fss , OkNNrdata * data , List * reloids );
271-
272- /* Query preprocessing hooks */
273- extern void print_into_explain (PlannedStmt * plannedstmt , IntoClause * into ,
274- ExplainState * es , const char * queryString ,
275- ParamListInfo params ,
276- const instr_time * planduration ,
277- QueryEnvironment * queryEnv );
278- extern void print_node_explain (ExplainState * es , PlanState * ps , Plan * plan );
279-
280239/* Cardinality estimation */
281240extern double predict_for_relation (List * restrict_clauses , List * selectivities ,
282241 List * relsigns , int * fss );
283242
284- /* Query execution statistics collecting hooks */
285- void aqo_ExecutorStart (QueryDesc * queryDesc , int eflags );
286- void aqo_ExecutorRun (QueryDesc * queryDesc , ScanDirection direction ,
287- uint64 count , bool execute_once );
288- void aqo_ExecutorEnd (QueryDesc * queryDesc );
289-
290243/* Automatic query tuning */
291244extern void automatical_query_tuning (uint64 query_hash , struct StatEntry * stat );
245+ extern double get_mean (double * elems , int nelems );
292246
293247/* Utilities */
294248extern int int_cmp (const void * a , const void * b );
@@ -306,8 +260,10 @@ extern void selectivity_cache_clear(void);
306260
307261extern bool IsQueryDisabled (void );
308262
309- extern bool update_query_timeout (uint64 queryid , int64 smart_timeout );
310- extern double get_mean (double * elems , int nelems );
311-
312263extern List * cur_classes ;
264+
265+ extern void aqo_cardinality_hooks_init (void );
266+ extern void aqo_preprocessing_init (void );
267+ extern void aqo_postprocessing_init (void );
268+
313269#endif
0 commit comments