24#ifndef SQL_DERIVED_INCLUDED
25#define SQL_DERIVED_INCLUDED
Used to pass information during condition pushdown.
Definition: sql_derived.h:79
Query_block * m_derived_query_block
Definition: sql_derived.h:82
Derived_table_info(Table_ref *derived_table, Query_block *query_block)
Definition: sql_derived.h:87
Table_ref * m_derived_table
Definition: sql_derived.h:81
bool is_set_operation() const
Definition: sql_derived.h:83
Class which handles pushing conditions down to a materialized derived table.
Definition: sql_derived.h:61
Item * m_having_cond
Condition that would be attached to the HAVING clause of the derived table.
Definition: sql_derived.h:125
enum_checking_purpose m_checking_purpose
Definition: sql_derived.h:158
Item * m_cond_to_check
Condition that needs to be checked to push down to the derived table.
Definition: sql_derived.h:103
Table_ref * m_derived_table
Derived table to push the condition to.
Definition: sql_derived.h:106
Item * m_where_cond
Condition that would be attached to the WHERE clause of the derived table.
Definition: sql_derived.h:131
bool push_past_group_by()
Try to push the condition or parts of the condition past GROUP BY into the WHERE clause of the derive...
Definition: sql_derived.cc:1316
Item * m_cond_to_push
Condition that is extracted from outer WHERE condition to be pushed to the derived table.
Definition: sql_derived.h:113
Opt_trace_context * trace
Optimizer trace context.
Definition: sql_derived.h:164
Item * m_orig_cond_to_push
set to m_cond_to_push before cloning (for query expressions with multiple query blocks).
Definition: sql_derived.h:119
bool attach_cond_to_derived(Item *derived_cond, Item *cond_to_attach, bool having)
Attach condition to derived table query block.
Definition: sql_derived.cc:1546
Item * get_remainder_cond()
Definition: sql_derived.h:76
bool make_remainder_cond(Item *cond, Item **remainder_cond)
Make the remainder condition.
Definition: sql_derived.cc:1352
bool make_cond_for_derived()
Make a condition that can be pushed down to the derived table, and push it.
Definition: sql_derived.cc:1048
Item * extract_cond_for_table(Item *cond)
This function is called multiple times to extract parts of a condition.
Definition: sql_derived.cc:1160
void check_and_remove_sj_exprs(Item *cond)
Check if this derived table is part of a semi-join.
Definition: sql_derived.cc:1448
THD * thd
Current thread.
Definition: sql_derived.h:161
void remove_sj_exprs(Item *cond, NESTED_JOIN *sj_nest)
This function examines the condition that is being pushed down to see if the expressions from the con...
Definition: sql_derived.cc:1475
bool replace_columns_in_cond(Item **cond, bool is_having)
Replace columns in a condition that will be pushed to this derived table with the derived table expre...
Definition: sql_derived.cc:1400
Condition_pushdown(Item *cond, Table_ref *derived, THD *thd_arg, Opt_trace_context *trace_arg)
Definition: sql_derived.h:63
Item * m_remainder_cond
Condition that would be left behind in the outer query block.
Definition: sql_derived.h:137
bool push_past_window_functions()
Try to push past window functions into the HAVING clause of the derived table.
Definition: sql_derived.cc:1279
enum_checking_purpose
Enum that represents various stages of checking.
Definition: sql_derived.h:153
@ CHECK_FOR_WHERE
Definition: sql_derived.h:156
@ CHECK_FOR_DERIVED
Definition: sql_derived.h:154
@ CHECK_FOR_HAVING
Definition: sql_derived.h:155
void update_cond_count(Item *cond)
Increment cond_count and between_count in the derived table query block based on the number of BETWEE...
Definition: sql_derived.cc:1517
Query_block * m_query_block
Query block to which m_cond_to_push should be pushed.
Definition: sql_derived.h:142
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
A per-session context which is always available at any point of execution, because in practice it's a...
Definition: opt_trace_context.h:90
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1156
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:623
Query_block * outer_query_block() const
Definition: sql_lex.h:853
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Query_expression * derived_query_expression() const
Return the query expression of a derived table or view.
Definition: table.h:3265
bool is_set_operation() const
Definition: sql_lex.h:2401
This contains the declaration of class Opt_trace_context, which is needed to declare THD.
File containing constants that can be used throughout the server.
Struct NESTED_JOIN is used to represent how tables are connected through outer join operations and se...
Definition: nested_join.h:78