From 4387e8852a05a10bb607c2d4857a0c8ea88855d1 Mon Sep 17 00:00:00 2001 From: bjyb <1091839467@qq.com> Date: Mon, 18 Sep 2023 14:35:37 +0800 Subject: [PATCH] Update index_advisor.cpp --- .../dbmind/kernel/index_advisor.cpp | 71 ++++++++++++++++++- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/src/gausskernel/dbmind/kernel/index_advisor.cpp b/src/gausskernel/dbmind/kernel/index_advisor.cpp index c211f50c2..0a3def97e 100644 --- a/src/gausskernel/dbmind/kernel/index_advisor.cpp +++ b/src/gausskernel/dbmind/kernel/index_advisor.cpp @@ -485,6 +485,14 @@ void get_join_condition_from_plan(Node* node, List* rtable) } } +/*/*Add_index function: + +Parameter: (table cell * table, char * index _ name) + +Return value: None. + +Function: Add nodes to the table.*/ + void add_index(TableCell *table, char *index_name) { IndexCell *index = (IndexCell *)palloc0(sizeof(*index)); @@ -521,6 +529,8 @@ void add_index(TableCell *table, char *index_name) } } + + void get_order_condition_from_plan(Node* node) { Sort *sortopt = (Sort *)node; @@ -564,6 +574,14 @@ void get_order_condition_from_plan(Node* node) } } +/*Free_global_resource function + +Formal parameter: none + +Return value: None + +Role: release global resources.*/ + void free_global_resource() { list_free(g_drived_tables); @@ -577,7 +595,14 @@ void free_global_resource() g_driver_table = NULL; } -/* Search the oid of all indexes created on the table through the oid of the table, +/* +Get_table_indexes function: + +Parameter: oid + +Back to: list + +Search the oid of all indexes created on the table through the oid of the table, * and return the index oid list. */ List *get_table_indexes(Oid oid) @@ -650,7 +675,11 @@ List *get_index_attname(Oid index_oid) return attnames; } -// Execute an SQL statement and return its result. +/* +Execute_ Stmt function: +Formal parameters: (const char * query_string, bool need_result) +Return: StmtResult +Execute an SQL statement and return the result.*/ StmtResult *execute_stmt(const char *query_string, bool need_result) { int16 format = 0; @@ -757,7 +786,14 @@ void shutdown(DestReceiver *self) { /* nothing */ } -/* Release resources */ +/* +Destroy function: + +Parameter: (DestReceiver *self) + +Return: None + +The function frees all allocated memory.Release resources */ void destroy(DestReceiver *self) { StmtResult *result = (StmtResult *)self; @@ -772,6 +808,15 @@ void destroy(DestReceiver *self) } /* + +Find_select_stmt function: + +Parameter: (Node *parsetree) + +Return: None + +Recursively search the SelectStmt structure in the parse tree. + * find_select_stmt * Recursively search for SelectStmt structures within a parse tree. * @@ -927,6 +972,12 @@ void get_partition_index_type(IndexPrint *suggested_index, TableCell *table) } /* +Generate_ Index_ Print function: +Formal parameters: (TableCell * table, char * index_print) +Return: IndexPrint* +Generate Index Printing + + * generat_index_print * Generate index type, normal table is '' by default * partition table is divided into local and global. @@ -972,6 +1023,15 @@ IndexPrint *generat_index_print(TableCell *table, char *index_print) return suggested_index; } + +/*Find_table function: + +Parameter: (TableCell *table) + +Return: TableCell* + +Find index table*/ + TableCell *find_table(TableCell *table) { ListCell *item = NULL; @@ -1528,6 +1588,11 @@ uint4 calculate_field_cardinality(char *schema_name, char *table_name, const cha return cardinality; } +/*Split_ Field_ List function: +Formal parameters: (List * fields, char * * schema_name_ptr, char * * table_name_ptr, char * * col_name_ptr) +Return: None +Split the specified area index table*/ + void split_field_list(List *fields, char **schema_name_ptr, char **table_name_ptr, char **col_name_ptr) { if (fields == NULL) {