MySQL  8.0.17
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 Member Functions

 Temp_table_param (MEM_ROOT *mem_root= *THR_MALLOC)
 
void cleanup ()
 

Public Attributes

Memroot_vector< Item_copy * > grouped_expressions
 Used to store the values of grouped non-column-reference expressions in between groups, so they can be retreived when the group changes. More...
 
Memroot_vector< 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
 
uint field_count
 Number of normal fields in the query, including those referred to from aggregate functions. More...
 
uint func_count
 Number of fields in the query that have functions. 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 atleast 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 m_window_short_circuit
 (Last) window's tmp file step can be skipped More...
 
bool m_window_frame_buffer {false}
 This tmp table is used for a window's frame buffer. 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.

Constructor & Destructor Documentation

◆ Temp_table_param()

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

Member Function Documentation

◆ cleanup()

void Temp_table_param::cleanup ( void  )
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

Memroot_vector<Copy_field> Temp_table_param::copy_fields

◆ end_write_records

ha_rows Temp_table_param::end_write_records

◆ field_count

uint Temp_table_param::field_count

Number of normal fields in the query, including those referred to from aggregate functions.

Hence, "SELECT `field1`, SUM(`field2`) from t1" sets this counter to 2.

See also
count_field_types

◆ force_copy_fields

bool Temp_table_param::force_copy_fields

◆ func_count

uint Temp_table_param::func_count

Number of fields in the query that have functions.

Includes both aggregate functions (e.g., SUM) and non-aggregates (e.g., RAND) and windowing functions. 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

◆ grouped_expressions

Memroot_vector<Item_copy *> Temp_table_param::grouped_expressions

Used to store the values of grouped non-column-reference expressions in between groups, so they can be retreived when the group changes.

See also
setup_copy_fields
copy_fields

◆ 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_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.

◆ m_window_short_circuit

bool Temp_table_param::m_window_short_circuit

(Last) window's tmp file step can be skipped

◆ 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_LIST::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

◆ using_outer_summary_function

bool Temp_table_param::using_outer_summary_function

Enabled when we have atleast 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: