从static调用成员变量
只能通过对象的方式
出来一个暂时性的结果,纪念下
基类与子类
基类处理流程中的函数,如果子类有实现,就会使用子类的,否则使用基类的。
字符数组优雅遍历
#include<iostream>intmain(){constchar*options[]={"test1","test2","test1","test2",NULL};inti=0;while(options[i]){std::cout<<options[i]<&
开发方式-继续探究敏捷的方式
总是难以达到真正的全面。如果想到全面,又没去实现它,怎么能保证想的是正确的呢?所以继续采用敏捷的开发
这样的SQL居然能执行
select/*!distinctcities.idfromcitiesjoincountriesoncities.id=countries.idlimit10*/;
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又要加几个变量
巨大的结构体,终归要变成巨大
算法的想法
给点算法规格说明书,以最小的时间和空间复杂度去实现