typedef struct st_join_table {
st_join_table() {} /* Remove gcc warning */
TABLE *table;
KEYUSE *keyuse; /**< pointer to first used key */
SQL_SELECT *select;
/**
When doing filesort, the select object is used for building the
sort index. After the sort index is built, the pointer to the
select object is set to NULL to avoid that it is used when reading
the result records (@see create_sort_index()). For subqueries that
do filesort and that are executed multiple times, the pointer to
the select object must be restored before the next execution both
to ensure that the select object is used and to be able to cleanup
the select object after the final execution of the subquery. In
order to be able to restore the pointer to the select object, it
is saved in saved_select in create_sort_index() and restored in
JOIN::exec() after the main select is done.
*/
SQL_SELECT *saved_select;
COND *select_cond;
QUICK_SELECT_I *quick;
Item **on_expr_ref; /**< pointer to the associated on expression */
COND_EQUAL *cond_equal; /**< multiple equalities for the on expression */
st_join_table *first_inner; /**< first inner table for including outerjoin */
bool found; /**< true after all matches or null complement */
bool not_null_compl;/**< true before null complement is added */
st_join_table *last_inner; /**< last table table for embedding outer join */
st_join_table *first_upper; /**< first inner table for embedding outer join */
st_join_table *first_unmatched; /**< used for optimization purposes only */ /* Special content for EXPLAIN 'Extra' column or NULL if none */
const char *info;
/*
Bitmap of TAB_INFO_* bits that encodes special line for EXPLAIN 'Extra'
column, or 0 if there is no info.
*/
uint packed_info; READ_RECORD::Setup_func read_first_record;
Next_select_func next_select;
READ_RECORD read_record;
/*
Currently the following two fields are used only for a [NOT] IN subquery
if it is executed by an alternative full table scan when the left operand of
the subquery predicate is evaluated to NULL.
*/
READ_RECORD::Setup_func save_read_first_record;/* to save read_first_record */
READ_RECORD::Read_func save_read_record;/* to save read_record.read_record */
double worst_seeks;
key_map const_keys; /**< Keys with constant part */
key_map checked_keys; /**< Keys checked in find_best */
key_map needed_reg;
key_map keys; /**< all keys with can be used */ /* Either #rows in the table or 1 for const table. */
ha_rows records;
/*
Number of records that will be scanned (yes scanned, not returned) by the
best 'independent' access method, i.e. table scan or QUICK_*_SELECT)
*/
ha_rows found_records;
/*
Cost of accessing the table using "ALL" or range/index_merge access
method (but not 'index' for some reason), i.e. this matches method which
E(#records) is in found_records.
*/
ha_rows read_time; table_map dependent,key_dependent;
uint use_quick,index;
uint status; ///< Save status for cache
uint used_fields,used_fieldlength,used_blobs;
enum join_type type;
bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct;
bool sorted;
/*
If it's not 0 the number stored this field indicates that the index
scan has been chosen to access the table data and we expect to scan
this number of rows for the table.
*/
ha_rows limit;
TABLE_REF ref;
JOIN_CACHE cache;
JOIN *join;
/** Bitmap of nested joins this table is part of */
nested_join_map embedding_map; void cleanup();
/*
In cases where filesort reads rows from a table using Loose Index
Scan, the fact that LIS was used is lost because
create_sort_index() deletes join_tab->select->quick. MySQL needs
this information during JOIN::exec(). This variable is a hack for MySQL 5.5 only. A value of true means
that filesort used LIS to read from the table. In MySQL 5.6 and
later, join_tab->filesort is a separate structure with it's own
select that can be inquired to get the same information. There is
no need for this variable in MySQL 5.6 and later.
*/
bool filesort_used_loose_index_scan;
/*
Similar hack as for filesort_used_loose_index_scan. Not needed for
MySQL 5.6 and later.
*/
bool filesort_used_loose_index_scan_agg_distinct;
inline bool is_using_loose_index_scan()
{
return (filesort_used_loose_index_scan ||
(select && select->quick &&
(select->quick->get_type() ==
QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
);
}
bool is_using_agg_loose_index_scan ()
{
return (filesort_used_loose_index_scan_agg_distinct ||
(select && select->quick &&
(select->quick->get_type() ==
QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) &&
((QUICK_GROUP_MIN_MAX_SELECT *)select->quick)->is_agg_distinct())
);
}
} JOIN_TAB;

JOIN_TAB的更多相关文章

  1. join_tab计算代价

    此路不通,还是需要按照顺序进行计算

  2. Mysql命令show global status求根溯源

    近来,发现好多公司对mysql的性能监控是通过show global status实现的,因此对于这个命令想要探究一番,看他是否是实时更新的. 在此之前,我们必须搞明白mysql对于这个命令的执行过程 ...

  3. MySQL AHI 实现解析

    版权声明:本文由musazhang原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/904925001482373849 来源 ...

  4. 1110MySQL select实现原理

    转自http://www.jianshu.com/p/NsWbRv 工作中需要借鉴MySQL对于select的具体实现,在网上搜了很久,几乎都是介绍原理的,对于实现细节都没有介绍,无奈之下只得自己对着 ...

  5. class JOIN

    class JOIN :public Sql_alloc { JOIN(const JOIN &rhs); /**< not implemented */ JOIN& opera ...

  6. MySQL优化器join顺序

    前一篇介绍了cost的计算方法,下面测试一下两表关联的查询: 测试用例 CREATE TABLE `xpchild` ( `id` int(11) NOT NULL, `name` varchar(1 ...

  7. MySQL优化器cost计算

    记录MySQL 5.5上,优化器进行cost计算的方法. 第一篇: 单表的cost计算 数据结构: 1. table_share: 包含了表的元数据,其中索引部分: key_info:一个key的结构 ...

  8. [MySQL 5.6] 初识5.6的optimizer trace

      在MySQL5.6中,支持将执行的SQL的查询计划树记录下来,目前来看,即使对于非常简单的查询,也会打印出冗长的查询计划,看起来似乎不是很可读,不过对于一个经验丰富,对查询计划的生成过程比较了解的 ...

  9. 腾讯云数据库团队:MySQL AHI 实现解析

    MySQL 定位用户记录的过程可以描述为:打开索引 -> 根据索引键值逐层查找 B+ 树 branch 结点 -> 定位到叶子结点,将 cursor 定位到满足条件的 rec 上:如果树高 ...

随机推荐

  1. .NET设计模式(15):结构型模式专题总结(转)

    摘要:结构型模式,顾名思义讨论的是类和对象的结构,它采用继承机制来组合接口或实现(类结构型模式),或者通过组合一些对象,从而实现新的功能(对象结构型模式).这些结构型模式,它们在某些方面具有很大的相似 ...

  2. DB2 的create or update方法

    通过merge方法实现的: MERGE INTO IFEBASE.STYLE AS MT USING (SELECT :scenario AS SCENARIO_ID, :style AS SHAPE ...

  3. 深入理解jQuery的Event机制

    jQuery的Event模块非常强大.其功能远远比原生事件监听器强大许多,对同一个元素的监听只用一个eventListener,内部则是一个强大的观察者,根据匹配事件类型触发相应回调.jQuery不仅 ...

  4. 机器学习在 IT 运维管理中的必要性!

    机器学习技术在监控工具中的应用已经成为 IT 运维与 DevOps 团队的一大热点话题.尽管相关的使用案例很多,对 IT 团队而已真正的「杀手级应用」是机器学习如何提高实时事件管理能力,从而帮助较大规 ...

  5. (3)初次接触off

    boss布置任务了,要读入off文件,生成能显示出来的可执行文件,完成不了就要滚蛋 目前的东西还是不用保密的,到后面我就要设密码了 好,.off文件是什么? OFF,Object File Forma ...

  6. node操作MongoDB数据库之插入

    在上一篇中我们介绍了MongoDB的安装与配置,接下来的我们来看看在node中怎样操作MongoDB数据库. 在操作数据库之前,首先应该像关系型数据库一样建个数据库把... 启动数据库 利用命令提示符 ...

  7. 妙味课堂——HTML+CSS(第一课)

    一句话,还记忆不如烂笔头,何况还这么笨,记下笔记,也是记录这一路学习的过程. 妙味课堂第一课并未一味地先讲HTML,而是穿插着CSS讲解,这一点不同于一些其他视频,这一点挺特别的!所以这一课涉及到HT ...

  8. linux下tigervnc-servere服务的安装与使用

    关于tigervnc-servere的安装,可以直接使用本地yum源进行安装. [root@ ~]# yum install tigervnc-server -y 其中tigervnc的主要配置文件位 ...

  9. Log4net学习

    转自:http://www.cnblogs.com/sirkevin/archive/2012/06/13/2548449.html Log4net简介根据日志类别保存到不同的文件,并按照日期生成不同 ...

  10. AcmeAir安装AI探针--SaaS版

    一.安装SaaS版AI探针准备工作: 1.准备好可用的docker版AcmeAir应用 2.在SaaS官网tpm.oneapm.com上已注册可用的账号 3.登录tpm.oneapm.com,点击选择 ...