Update index_advisor.cpp

This commit is contained in:
bjyb 2023-09-18 14:35:37 +08:00
parent 42b6cbb501
commit 4387e8852a
1 changed files with 68 additions and 3 deletions

View File

@ -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) {