MySQL 9.1.0
Source Code Documentation
sql_union.cc File Reference
#include "sql/sql_union.h"
#include <sys/types.h>
#include <algorithm>
#include <atomic>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "mem_root_deque.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_dbug.h"
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "mysql/udf_registration_types.h"
#include "mysqld_error.h"
#include "prealloced_array.h"
#include "scope_guard.h"
#include "sql/auth/auth_acls.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/item_subselect.h"
#include "sql/iterators/row_iterator.h"
#include "sql/join_optimizer/access_path.h"
#include "sql/join_optimizer/bit_utils.h"
#include "sql/join_optimizer/explain_access_path.h"
#include "sql/join_optimizer/join_optimizer.h"
#include "sql/join_optimizer/materialize_path_parameters.h"
#include "sql/mem_root_array.h"
#include "sql/mysqld.h"
#include "sql/opt_explain.h"
#include "sql/opt_explain_format.h"
#include "sql/opt_trace.h"
#include "sql/parse_tree_node_base.h"
#include "sql/parse_tree_nodes.h"
#include "sql/parser_yystype.h"
#include "sql/pfs_batch_mode.h"
#include "sql/protocol.h"
#include "sql/query_options.h"
#include "sql/query_term.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_cmd.h"
#include "sql/sql_const.h"
#include "sql/sql_error.h"
#include "sql/sql_executor.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_optimizer.h"
#include "sql/sql_select.h"
#include "sql/sql_tmp_table.h"
#include "sql/table_function.h"
#include "sql/thd_raii.h"
#include "sql/visible_fields.h"
#include "sql/window.h"
#include "template_utils.h"

Classes

class  Query_result_union_direct
 This class is effectively dead. More...
 

Functions

static bool finalize_full_text_functions (THD *thd, Query_expression *query_expression)
 Finalizes the initialization of all the full-text functions used in the given query expression, and recursively in every query expression inner to the given one. More...
 
static bool contributes_to_rowcount_estimate (Query_block *qb)
 Determine if we should set or add the contribution of the given query block to the total row count estimate for the query expression. More...
 
static bool use_iterator (TABLE *materialize_destination, Query_term *query_term)
 
static void cleanup_tmp_tables (Table_ref *list)
 Closes (and, if last reference, drops) temporary tables created to materialize derived tables, schema tables and CTEs. More...
 
static void destroy_tmp_tables (Table_ref *list)
 Destroy temporary tables created to materialize derived tables, schema tables and CTEs. More...
 

Function Documentation

◆ cleanup_tmp_tables()

static void cleanup_tmp_tables ( Table_ref list)
static

Closes (and, if last reference, drops) temporary tables created to materialize derived tables, schema tables and CTEs.

Parameters
listList of tables to search in

◆ contributes_to_rowcount_estimate()

static bool contributes_to_rowcount_estimate ( Query_block qb)
static

Determine if we should set or add the contribution of the given query block to the total row count estimate for the query expression.

If we have INTERSECT or EXCEPT, only set row estimate for left side since the total number of rows in the result set can only decrease as a result of the set operation.

Parameters
qbquery block
Returns
true if the estimate should be added

◆ destroy_tmp_tables()

static void destroy_tmp_tables ( Table_ref list)
static

Destroy temporary tables created to materialize derived tables, schema tables and CTEs.

Parameters
listList of tables to search in

◆ finalize_full_text_functions()

static bool finalize_full_text_functions ( THD thd,
Query_expression query_expression 
)
static

Finalizes the initialization of all the full-text functions used in the given query expression, and recursively in every query expression inner to the given one.

We do this fairly late, since we need to know whether or not the full-text function is to be used for a full-text index scan, and whether or not that scan is sorted. When the iterators have been created, we know that the final decision has been made, so we do it right after the iterators have been created.

◆ use_iterator()

static bool use_iterator ( TABLE materialize_destination,
Query_term query_term 
)
static