|
static void | ReplaceUpdateValuesWithTempTableFields (Sql_cmd_insert_select *sql_cmd, Query_block *query_block, const mem_root_deque< Item * > &original_fields, const mem_root_deque< Item * > &temp_table_fields) |
| Replaces field references in an ON DUPLICATE KEY UPDATE clause with references to corresponding fields in a temporary table. More...
|
|
static void | CollectItemsWithoutRollup (Item *root, mem_root_deque< Item * > *items) |
| Collects the set of items in the item tree that satisfy the following: More...
|
|
static TABLE * | CreateTemporaryTableFromSelectList (THD *thd, Query_block *query_block, Window *window, Temp_table_param **temp_table_param_arg, bool after_aggregation) |
| Creates a temporary table with columns matching the SELECT list of the given query block. More...
|
|
static void | ReplaceSelectListWithTempTableFields (THD *thd, JOIN *join, const Func_ptr_array &items_to_copy) |
| Replaces the items in the SELECT list with items that point to fields in a temporary table. More...
|
|
void | ReplaceOrderItemsWithTempTableFields (THD *thd, ORDER *order, const Func_ptr_array &items_to_copy) |
|
table_map | anonymous_namespace{finalize_plan.cc}::GetUsedTableMap (const ORDER *order) |
|
bool | anonymous_namespace{finalize_plan.cc}::OrderItemsReferenceUnavailableTables (const AccessPath *sort_path, table_map used_tables_before_replacement) |
| Checks if the order items in a SORT access path reference any column that is not available to it. More...
|
|
static Temp_table_param * | GetItemsToCopy (AccessPath *path) |
|
static void | UpdateReferencesToMaterializedItems (THD *thd, Query_block *query_block, AccessPath *path, bool after_aggregation, Mem_root_array< const Func_ptr_array * > *applied_replacements) |
| See FinalizePlanForQueryBlock(). More...
|
|
static void | DelayedCreateTemporaryTable (THD *thd, Query_block *query_block, AccessPath *path, bool after_aggregation, TABLE **last_window_temp_table, unsigned *num_windows_seen) |
| If the given access path needs a temporary table, it instantiates said table (we cannot do this until we have a final access path list, where we know which temporary tables are created and in which order). More...
|
|
static void | FinalizeWindowPath (THD *thd, Query_block *query_block, const mem_root_deque< Item * > &original_fields, const Mem_root_array< const Func_ptr_array * > &applied_replacements, AccessPath *path) |
| See FinalizePlanForQueryBlock(). More...
|
|
static Item * | AddCachesAroundConstantConditions (Item *item) |
|
static bool | AddCachesAroundConstantConditionsInPath (AccessPath *path) |
|
bool | FinalizePlanForQueryBlock (THD *thd, Query_block *query_block) |
|
Collects the set of items in the item tree that satisfy the following:
1) Neither the item itself nor any of its descendants have a reference to a ROLLUP expression (item->has_grouping_set_dep() evaluates to false). 2) The item is either the root item or its parent item does not satisfy 1).
In other words, we do not collect every item without rollup in the tree. Instead we collect the root item of every largest possible subtree where none of the items in the subtree have rollup.
- Parameters
-
root | The root item of the tree to search. |
items | A collection of items. We add items that satisfy the search criteria to this collection. |
Creates a temporary table with columns matching the SELECT list of the given query block.
(In FinalizePlanForQueryBlock(), the SELECT list of the query block is updated to point to the fields in the temporary table, but not here.)
This function is used for materializing the query result, either as an intermediate step before sorting the final result if the sort requires the rows to come from a single table instead of a join, or as the last step if the SQL_BUFFER_RESULT query option has been specified. It is also used for setting up the output temporary table for window functions.
NOTE: If after_aggregation = true, it is impossible to call this function again later with after_aggregation = false, as count_field_types() will remove item->has_aggregation() once called. Thus, we need to set up all these temporary tables in FinalizePlanForQueryBlock(), in the right order.
static void DelayedCreateTemporaryTable |
( |
THD * |
thd, |
|
|
Query_block * |
query_block, |
|
|
AccessPath * |
path, |
|
|
bool |
after_aggregation, |
|
|
TABLE ** |
last_window_temp_table, |
|
|
unsigned * |
num_windows_seen |
|
) |
| |
|
static |
If the given access path needs a temporary table, it instantiates said table (we cannot do this until we have a final access path list, where we know which temporary tables are created and in which order).
For window functions, it also needs to forward this information to the materialization access path coming right after this window, if any, so it uses last_window_temp_table as a buffer to hold this.