23#ifndef SQL_DERIVED_INCLUDED
24#define SQL_DERIVED_INCLUDED
Used to pass information during condition pushdown.
Definition: sql_derived.h:78
Query_block * m_derived_query_block
Definition: sql_derived.h:81
Derived_table_info(Table_ref *derived_table, Query_block *query_block)
Definition: sql_derived.h:86
Table_ref * m_derived_table
Definition: sql_derived.h:80
bool is_set_operation() const
Definition: sql_derived.h:82
Class which handles pushing conditions down to a materialized derived table.
Definition: sql_derived.h:60
Item * m_having_cond
Condition that would be attached to the HAVING clause of the derived table.
Definition: sql_derived.h:124
enum_checking_purpose m_checking_purpose
Definition: sql_derived.h:157
Item * m_cond_to_check
Condition that needs to be checked to push down to the derived table.
Definition: sql_derived.h:102
Table_ref * m_derived_table
Derived table to push the condition to.
Definition: sql_derived.h:105
Item * m_where_cond
Condition that would be attached to the WHERE clause of the derived table.
Definition: sql_derived.h:130
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:1288
Item * m_cond_to_push
Condition that is extracted from outer WHERE condition to be pushed to the derived table.
Definition: sql_derived.h:112
Opt_trace_context * trace
Optimizer trace context.
Definition: sql_derived.h:163
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:118
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:1518
Item * get_remainder_cond()
Definition: sql_derived.h:75
bool make_remainder_cond(Item *cond, Item **remainder_cond)
Make the remainder condition.
Definition: sql_derived.cc:1324
bool make_cond_for_derived()
Make a condition that can be pushed down to the derived table, and push it.
Definition: sql_derived.cc:1020
Item * extract_cond_for_table(Item *cond)
This function is called multiple times to extract parts of a condition.
Definition: sql_derived.cc:1132
void check_and_remove_sj_exprs(Item *cond)
Check if this derived table is part of a semi-join.
Definition: sql_derived.cc:1420
THD * thd
Current thread.
Definition: sql_derived.h:160
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:1447
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:1372
Condition_pushdown(Item *cond, Table_ref *derived, THD *thd_arg, Opt_trace_context *trace_arg)
Definition: sql_derived.h:62
Item * m_remainder_cond
Condition that would be left behind in the outer query block.
Definition: sql_derived.h:136
bool push_past_window_functions()
Try to push past window functions into the HAVING clause of the derived table.
Definition: sql_derived.cc:1251
enum_checking_purpose
Enum that represents various stages of checking.
Definition: sql_derived.h:152
@ CHECK_FOR_WHERE
Definition: sql_derived.h:155
@ CHECK_FOR_DERIVED
Definition: sql_derived.h:153
@ CHECK_FOR_HAVING
Definition: sql_derived.h:154
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:1489
Query_block * m_query_block
Query block to which m_cond_to_push should be pushed.
Definition: sql_derived.h:141
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:91
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1162
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:33
Query_expression * derived_query_expression() const
Return the query expression of a derived table or view.
Definition: table.h:3274
bool is_set_operation() const
Definition: sql_lex.h:2404
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:77