join_tab计算代价
此路不通,还是需要按照顺序进行计算
outer join test
createtablet1_outerjoin(aint,bint,cint);createtablet2_outerjoin(aint);createtablet3_outerjoin(aint,bint);createtablet4_outerjoin(aint);SELECT*FROMt1_o
突然觉得mysql优化器蛮简单
当然是在折腾了很长时间之后
使用union 外加count
explainextendedselectcount(*)from(selectidfromstateswherecountry_id<100union(selectidfromcountrieswhereid>10andname='aaa'))t;+----+-------------
使用union
QUERY:explainextendedselectidfromstateswherecountry_id<100union(selectidfromcountrieswhereid>10)TRACE:{"steps":[{"join_preparation":{"select#":1
使用duplicateweedout
mysql>explainextendedselect*fromcitieswhereidin(selectphonecodefromcountriesgroupbyname);+----+-------------+-----------+--------+---------------+-
使用materialization
explainselect`countries`.`id`AS`id`,`countries`.`sortname`AS`sortname`,`countries`.`name`AS`name`,`countries`.`phonecode`AS`phonecode`from`countries`w
explain获得使用的key的数据
boolExplain_join::explain_key_and_len(){if(tab->ref.key_parts)returnexplain_key_and_len_index(tab->ref.key,tab->ref.key_length,tab->ref.ke
mysql源码
从代码的角度来说,没有丝毫设计感,尤其是优化器部分。不过那些是常年累积的原因,一些新加较独立的部分,设计的就很舒服,真正的面向对象做法。
单张表用到多个索引
多表自join,就会用到多个
memory引擎和innodb引擎速度对比
ysql>insertintoinnodb_test(name)selectnamefrominnodb_test;QueryOK,1048576rowsaffected(1min9.47sec)Records:1048576Duplicates:0Warnings:0mysql>ins
mysql表的核心元数据
索引的mysql>showindexesfromrecordsInRangeTest;+--------------------+------------+--------------+--------------+-------------+-----------+-------------
在thd又要加几个变量
巨大的结构体,终归要变成巨大
算法的想法
给点算法规格说明书,以最小的时间和空间复杂度去实现
算法导论
原理、实现细节、复杂度证明
算法真的复杂
有了基本思路后,如何以最简洁的方式去实现关键点,非常重要。简洁意味着清楚、易理解、不易出错
快速排序-移动单边指针
/*CimplementationQuickSort*/#include<stdio.h>//Autilityfunctiontoswaptwoelementsvoidswap(int*a,int*b){intt=*a;*a=*b;*b=t;}/*Thisfunctiontakeslas
如何实现算法
可以实现的描述单元
c++ constructor, copy constructor, operator =
//list::push_back#include<iostream>#include<list>classelement{private:intnumber;public:element(intnumber){this->number=number;std::cout
阶段性总结
1、MySQL中List实现与C++库的List实现不同2、类的关系不清楚,需要类图来理清3、流程不是非常清晰,需要列出接口4、探索性实现,先实现简要框架,对要完善的功能加上todo,以便记忆