MySQL 8.4.3
Source Code Documentation
Temp_table_param Class Reference

Object containing parameters used when creating and using temporary tables. More...

#include <temp_table_param.h>

Public Types

enum  { TTP_UNION_OR_TABLE , TTP_EXCEPT , TTP_INTERSECT }
 For INTERSECT and EXCEPT computation. More...
 

Public Member Functions

bool needs_set_counter ()
 The tempoary table rows need a counter to keep track of its duplicates: needed for EXCEPT and INTERSECT computation. More...
 
 Temp_table_param (MEM_ROOT *mem_root= *THR_MALLOC)
 
 Temp_table_param (MEM_ROOT *mem_root, const Temp_table_param &other)
 
Temp_table_paramoperator= (const Temp_table_param &other)
 
void cleanup ()
 

Public Attributes

Mem_root_array< Copy_fieldcopy_fields
 
uchargroup_buff
 
Func_ptr_arrayitems_to_copy
 
KEYkeyinfo
 After temporary table creation, points to an index on the table created depending on the purpose of the table - grouping, duplicate elimination, etc. More...
 
ha_rows end_write_records {HA_POS_ERROR}
 LIMIT (maximum number of rows) for this temp table, or HA_POS_ERROR for no limit. More...
 
uint func_count
 Number of items in the query. More...
 
uint sum_func_count
 Number of fields in the query that have aggregate functions. More...
 
uint hidden_field_count
 
uint group_parts
 
uint group_length
 
uint group_null_parts
 
bool allow_group_via_temp_table {true}
 Whether we allow running GROUP BY processing into a temporary table, i.e., keeping many different aggregations going at once without having ordered input. More...
 
uint outer_sum_func_count
 Number of outer_sum_funcs i.e the number of set functions that are aggregated in a query block outer to this subquery. More...
 
bool using_outer_summary_function
 Enabled when we have at least one outer_sum_func. More...
 
CHARSET_INFOtable_charset
 
bool schema_table
 
bool precomputed_group_by
 
bool force_copy_fields
 
bool skip_create_table
 true <=> don't actually create table handler when creating the result table. More...
 
bool bit_fields_as_long
 
bool can_use_pk_for_unique
 Whether the UNIQUE index can be promoted to PK. More...
 
bool force_hash_field_for_unique {false}
 Whether UNIQUE keys should always be implemented by way of a hidden hash field, never a unique index. More...
 
bool m_window_frame_buffer {false}
 This tmp table is used for a window's frame buffer. More...
 
enum Temp_table_param:: { ... }  TTP_UNION_OR_TABLE
 For INTERSECT and EXCEPT computation. More...
 
bool m_last_operation_is_distinct {false}
 For INTERSECT and EXCEPT computation. More...
 
Windowm_window
 If this is the out table of a window: the said window. More...
 

Detailed Description

Object containing parameters used when creating and using temporary tables.

Temporary tables created with the help of this object are used only internally by the query execution engine.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

For INTERSECT and EXCEPT computation.

Enumerator
TTP_UNION_OR_TABLE 
TTP_EXCEPT 
TTP_INTERSECT 

Constructor & Destructor Documentation

◆ Temp_table_param() [1/2]

Temp_table_param::Temp_table_param ( MEM_ROOT mem_root = *THR_MALLOC)
inlineexplicit

◆ Temp_table_param() [2/2]

Temp_table_param::Temp_table_param ( MEM_ROOT mem_root,
const Temp_table_param other 
)
inline

Member Function Documentation

◆ cleanup()

void Temp_table_param::cleanup ( void  )
inline

◆ needs_set_counter()

bool Temp_table_param::needs_set_counter ( )
inline

The tempoary table rows need a counter to keep track of its duplicates: needed for EXCEPT and INTERSECT computation.

◆ operator=()

Temp_table_param & Temp_table_param::operator= ( const Temp_table_param other)
inline

Member Data Documentation

◆ allow_group_via_temp_table

bool Temp_table_param::allow_group_via_temp_table {true}

Whether we allow running GROUP BY processing into a temporary table, i.e., keeping many different aggregations going at once without having ordered input.

This is usually the case, but is currently not supported for aggregation UDFs, aggregates with DISTINCT, or ROLLUP.

Note that even if this is true, the optimizer may choose to not use a temporary table, as it is often more efficient to just read along an index.

◆ bit_fields_as_long

bool Temp_table_param::bit_fields_as_long

◆ can_use_pk_for_unique

bool Temp_table_param::can_use_pk_for_unique

Whether the UNIQUE index can be promoted to PK.

◆ copy_fields

Mem_root_array<Copy_field> Temp_table_param::copy_fields

◆ end_write_records

ha_rows Temp_table_param::end_write_records {HA_POS_ERROR}

LIMIT (maximum number of rows) for this temp table, or HA_POS_ERROR for no limit.

Enforced by MaterializeIterator when writing to the table.

◆ force_copy_fields

bool Temp_table_param::force_copy_fields

◆ force_hash_field_for_unique

bool Temp_table_param::force_hash_field_for_unique {false}

Whether UNIQUE keys should always be implemented by way of a hidden hash field, never a unique index.

Needed for materialization of mixed UNION ALL / UNION DISTINCT queries (see comments in create_result_table()).

◆ func_count

uint Temp_table_param::func_count

Number of items in the query.

Includes both aggregate functions (e.g., SUM), and non-aggregates (e.g., RAND), window functions and fields. Also counts functions referred to from windowing or aggregate functions, i.e., "SELECT SUM(RAND())" sets this counter to 2.

See also
count_field_types

◆ group_buff

uchar* Temp_table_param::group_buff

◆ group_length

uint Temp_table_param::group_length

◆ group_null_parts

uint Temp_table_param::group_null_parts

◆ group_parts

uint Temp_table_param::group_parts

◆ hidden_field_count

uint Temp_table_param::hidden_field_count

◆ items_to_copy

Func_ptr_array* Temp_table_param::items_to_copy

◆ keyinfo

KEY* Temp_table_param::keyinfo

After temporary table creation, points to an index on the table created depending on the purpose of the table - grouping, duplicate elimination, etc.

There is at most one such index.

◆ m_last_operation_is_distinct

bool Temp_table_param::m_last_operation_is_distinct {false}

For INTERSECT and EXCEPT computation.

Cf. TABLE::m_last_operation_is_distinct.

◆ m_window

Window* Temp_table_param::m_window

If this is the out table of a window: the said window.

◆ m_window_frame_buffer

bool Temp_table_param::m_window_frame_buffer {false}

This tmp table is used for a window's frame buffer.

◆ outer_sum_func_count

uint Temp_table_param::outer_sum_func_count

Number of outer_sum_funcs i.e the number of set functions that are aggregated in a query block outer to this subquery.

See also
count_field_types

◆ precomputed_group_by

bool Temp_table_param::precomputed_group_by

◆ schema_table

bool Temp_table_param::schema_table

◆ skip_create_table

bool Temp_table_param::skip_create_table

true <=> don't actually create table handler when creating the result table.

This allows range optimizer to add indexes later. Used for materialized derived tables/views.

See also
Table_ref::update_derived_keys.

◆ sum_func_count

uint Temp_table_param::sum_func_count

Number of fields in the query that have aggregate functions.

Note that the optimizer may choose to optimize away these fields by replacing them with constants, in which case sum_func_count will need to be updated.

See also
optimize_aggregated_query, count_field_types

◆ table_charset

CHARSET_INFO* Temp_table_param::table_charset

◆ 

enum { ... } Temp_table_param::TTP_UNION_OR_TABLE

For INTERSECT and EXCEPT computation.

◆ using_outer_summary_function

bool Temp_table_param::using_outer_summary_function

Enabled when we have at least one outer_sum_func.

Needed when used along with distinct.

See also
create_tmp_table

The documentation for this class was generated from the following file: