您的位置 首页 golang

我们如何设计 Golang & SQL 引擎课程的?Talent Plan 背后的故事

作者:谢海滨

在 上篇文章 中我们介绍了 PingCAP Talent Plan – TiKV 方向的课程内容,本文将从课程设计的角度和大家聊一聊 TiDB 方向的课程内容,包括课程设计的逻辑,和课程学习过程中常见的问题及解答等。

TiDB 方向课程内容

TiDB 作为一个支持 MySQL 协议,以某种支持事务的分布式 KV 存储引擎为底层存储的 SQL 引擎,主要需要处理与 MySQL 客户端的交互,在底层存储引擎中存取数据,以及实现 SQL 功能。 在 Talent Plan 课程设计上,我们主要关注在如何实现 SQL 功能,并将重点放在如何实现 SQL 优化器以及执行引擎上:

  • 优化器 :主要负责生成并且优化查询计划,执行计划的好坏将极大影响执行效率,因此这一部分也可以说是整个 SQL 功能最核心的部分之一;
  • 执行引擎 :主要负责执行生成的查询计划,大部分 SQL 的执行逻辑都在这里,目前 TiDB 的执行框架已经由经典的火山模型改进为了向量化模型。

当然, Golang 作为 TiDB 使用的语言,在课程设计中也是非常重要的一部分。

课程设计

在线上课程的内容设计上,我们主要希望大家可以循序渐进地掌握数据库实现 SQL 功能的一些重要基石,这些内容可能并不局限于数据库领域,这样即使大家将来不从事数据库相关工作或者研究,也可以有所收获。 而在作业的设计上,一方面是需要紧密的贴合学习内容,另一方面是希望大家在完成作业的过程中可以尽可能有及时而准确的反馈,获得一些成就感~

在第一周的课程作业中,我们选取了归并排序来作为 Golang 的实战演练。相对来说,Golang 的语法并不复杂,这里主要需要掌握的是它的并发模型和性能调优工具,因此在题目的选择上需要尽可能的经典而且简单,这样大家的关注重心可以放在之前可能并不熟悉的 Golang 并发模型上,从这一点上来说,归并排序可以说是相当适合的选择了。

当然实现完成归并排序并不是我们唯一的目的,更重要的是大家可以对程序的运行代价有一个直观的认识,在这一点上 Go Profile 可以说是做的比较出色,通过性能这样容易衡量的指标,以及 Go Profile 这样的性能分析工具,相信大家在完成第一周作业的过程中可以更加得心应手。

在简单地完成和 Golang 的“初相识”后,第二周我们选择了 MapReduce 来帮助大家认识分布式计算。作为经典的计算模型,MapReduce 对 TiDB 来说非常重要,比如在 TiDB 的并行 Hash 聚合执行算子里可以看到 MapReduce 的影子。在这一周里,我们直接采用了 MIT 6.824 的 Lab 1。当然与第一周一样,这里另外一个比较重要的目标就是利用 Go Profile 来优化代码性能。

前两周的课程设置中,我们选择从两个比较经典的算法切入,来由浅入深地带大家学习优化性能,当然在实际操作过程中,面临的问题往往更复杂,也许 Profile 已经无法满足需求。这时我们就需要从更抽象的角度,来思考以及组合我们的计算模型。所以在第三周,我们选择了优化器作为切入点,带大家了解数据库是如何从更抽象的层面优化执行代价的。这一周,大家可以简单地了解逻辑算子和物理算子,学习它们优化方式的不同。 在为大家提交的作业评分时,我们发现很多同学只是从物理优化的层面去考虑问题,也就是只考虑了 Join 算子的不同实现方式,而没有从逻辑执行计划的角度考虑问题,导致错失大量分数,希望后面的同学可以多加注意。

最后一周的线上课程可以说是对前三周课程知识的总结。在实现并优化一个带有 Join 以及聚合的 SQL 语句的过程中,大家既可以从第二周学到的执行框架上去考虑,也可以从逻辑以及物理算子的角度考虑,可以说是一个相当开放且有趣的题目。

线下课程是线上课程的一个延伸和连续。在学习完线上课程后,相信大家会对数据库有一个基本的了解,在线下课程中我们将继续带领大家学习 TiDB 是如何实现优化器以及执行引擎的。当然除了 TiDB 现有的实现外,我们也希望可以带大家看看业界前沿的研究,拓宽视野。更多的细节已在 这篇文章 中披露,在这就不赘述了。

FAQ

下面是我们经常被问到的几个问题,在此和大家分享一下。

Q1: Merge Sort 的理想性能该是多少?应该要比 Normal Sort 快几倍?

A1: 这个主要取决于具体的 CPU 数目,性能上当然是要越快越好了。

Q2: MapReduce 的作业消耗空间比较大,跑不完怎么办?

A2: 可以更改测试文件里的数据量大小,调到自己可以运行的程度,并以此为基准来优化就可以了。

Q3: Plan Tree 该怎么画?有标准画法么?

A3: 在作业中只需要以书本上类似的形式画出来就可以了,当然如果算子的含义与书上的不同,需要在作业中标注出来。

Q4: Join 算子优化前后耗时很接近,该怎么办?

A4: 题目中给出的接口会主要耗在读文件上,可以考虑测试读文件之后的处理时间。

以上是关于 PingCAP Talent Plan – TiDB 方向课程的介绍,欢迎大家参与课程学习,也非常欢迎大家对课程提出意见和建议,在这里也要特别感谢 @Jiaolong 同学提供 Effective Go 的学习地址,为大家学习 Go 语言提供了更加丰富的学习素材。

文章来源:智云一二三科技

文章标题:我们如何设计 Golang & SQL 引擎课程的?Talent Plan 背后的故事

文章地址:https://www.zhihuclub.com/98193.shtml

关于作者: 智云科技

热门文章

评论已关闭

37条评论

  1. 69, the random effect model was selected for statistical analysis Tadalista Softgelss is a prescription medication, one needs share the medical history with a doctor to make sure it is an appropriate treatment

  2. This metabolite has a PDE selectivity profile similar to sildenafil and an in vitro potency for PDE5 approximately 50 of the parent drug

  3. It usually also comes with abdominal pain that can be serious. Examples include azole antifungals such as itraconazole, ketoconazole, macrolide antibiotics such as clarithromycin, HIV protease inhibitors such as lopinavir, ritonavir, among others.

  4. All I can say is that I m very sure there is more puffiness than there was before I started finasteride burgdorferi, B

  5. Tamoxifen reduces the risk of breast cancer in women with BRCA2 mutations, but has no effect in women with BRCA1 mutations, according to preliminary results presented at the 37th Annual Meeting of the American Society for Clinical Oncology

  6. Novel second generation analogs of eribulin We also acknowledge the Advanced Light Microscopy Spectroscopy Core at the California NanoSystems Institute at UCLA for the use of the confocal microscopes to acquire the CLARITY image stacks

  7. Influence of an exocyclic guanine adduct on the thermal stability, conformation, and melting thermodynamics of a DNA duplex

  8. The solvents were then removed in vacuo to yield 5 bromo 3 2, 6 dichloro 3 fluoro benzyloxy pyridin 2 ylamine 5

  9. It s the same thing, Do you think it s an ACL not with Mario, I m talking about with players in general

  10. In our stakeholder discussions, patient representatives were vocal in identifying uncertainty both before and after treatment as a major cause of ongoing distress, a finding that is supported by the literature

  11. For the rest, this anabolic can be accompanied by undesirable manifestations when combined with other pharmaceuticals characterized by high androgenic activity

  12. cymbalta ivermectin latest study While Japan s Softbank Corp, which owns 35 percentof Alibaba, and Internet company Yahoo, with 24 percent, eachhave a seat on Alibaba s four person board of directors, neithercompany is represented among the 28 partners Nevertheless, caution is required as tamoxifen could interact with certain antiretroviral agents

  13. I did all the ne cessary test and everything seems to be ok with me but my doctor still prescribed clomid to boost our chance of getting pregnant low blood platelet counts due to chronic hepatitis C virus HCV infection before and during treatment with interferon

  14. Of 21 women in the RT arm who died as a result of breast cancer, 18 actually received RT, and of these, only nine 50

  15. I just felt like I needed to take a full break from that but I always did really well 000 Size of ulcers Day 8 5 Amlexanox

  16. Just do your best 1 hours, in comparison to the placebo, the use of which was associated with an average labor time of 8

  17. severe hyperglycemia levels or Diet Cure Diabetes, Is There A Pill To Lower Blood Sugar

  18. Updated guidelines including an overview on acute heart failure as developed by the European Society of Cardiology

  19. Carolyn Presley, MD, of The Ohio State University, discusses the differences between chemo brain, cognitive aging, and dementia in patients with thoracic cancer who are in treatment; how to test for impairment; and the interventions that can improve cognitive changes in survivors

  20. In order to speed up novel treatment for MDR TB, we suggest considering expanding the indications of already available drugs

  21. Potent inhibition of heterotopic ossification by nuclear retinoic acid receptor gamma agonists

  22. After having the direction, Huang Qing searched around in the Huang family, and finally found Zhao Ling in an open place

网站地图