Worktable as Continuations

Not sure why I came again to this interesting paper One WITH RECURSIVE is Worth Many GOTOs. Daily work on Greenplum makes me think and inspires me to learn knowledge in different areas of computer science. This paper was accepted in the same SIGMOD as Greenplum’s HTAP paper and I have a vague impression of it. Recently three tasks in my work made me peruse the paper:

  1. Fix a customer JIRA on recursive CTE
  2. Answer questions from my colleague on the implementation of KNN in Greenplum (I advise using lateral join with some enhancement of Optimizer)
  3. My own spike on the labels as values skill in Greenplum(Postgres)’s expression valuation

This paper uses recursive CTE, Lateral Join and Union All with filters to implement control structure such as Loop, Condition in PLPGSQL. So now is a good time to start a new tour.

Continue reading

探囊取物——理解,诊断,修复Greenplum中的Opclass和Opfamily相关问题

我已经不止一次有这样的感觉了: 当遇到一个特性类型的bug后,短时间内会频繁遇到本质一样的bug。这次是Greenplum关于OpclassOpfamily的话题。这种模式不是偶然,我有一个猜想来解释:遇到第一个问题的时候,如果能够深入仔细的研究思考,由点及面,然后这部分储备的知识和思维的训练,让你更容易从代码和issue里看出同类问题。

本文介绍Greenplum Database里的OpclassOpfamily相关概念,然后列出Greenplum开源社区仓库 greenplum-db/gpdb 里一些关于这个话题的issue并逐一诊断分析。各小节独立自成一个话题,小节之间可能会显得跳跃。不同的参考资料也将散落在各个小节内部。Issue修复的过程是动态的,我会把在开源社区出现过的东西online session里讨论清楚并公布录屏。

Continue reading

👻幽灵捕手——Dancing Links

缘由

之前一阵子,慕慕妈妈给慕慕买了一个益智小玩具——👻幽灵捕手。

刚刚通了一关的吕小慕

这个游戏的介绍视频可以参考: 幽灵捕手玩法视频。整整一年前我恰好看了Knuth的Dancling Links(参考之前的blog: https://kainwen.com/2022/01/03/dancing-links/ ) ,最近看着吕小慕玩儿这个游戏,顿时觉得,这就是一个可以用Dancling Links解决的Exact Cover Problem。那就让我们来试试看吧。

Continue reading

🐶🐰谜题

背景:Greenplum Team的Big Standup

Greenplum Team有一个源自从Pivotal时代的晨会仪式,称为Big Standup。2020年4月,被收购成为VMware Greenplum后,由于VMware的未来办公模式,永久的远程办公(甚至可以改Base),中国团队每天的Standup改为线上的zoom,为了更加活泼有趣,主持人需要想一个游戏,或者做一个小分享。这个活动成为了每天最吸引人的事情了。

谜题介绍:Dog Bunny Puzzle

有一个同事,找了一个有趣的类似华容道的益智游戏,对应的网站是 https://www.dogbunnypuzzle.com/。2022年12月24日的那个关卡如下图:

2022年12月24日的犬兔谜题
Continue reading

Analysis of Algorithm S

Last week I have a discussion with a colleague who is working on improving the analyze-speed of AO|AOCS table in Greenplum (at least 10x speed up). We search the Internet and do not find the performance analysis of Algorithm S and Knuth’s TAOCP left this (mean and var) as exercises. This blog is the solution to Knuth’s exercises.

Continue reading

不踬于山——追踪内存泄漏

不踬于山,而踬于垤。—— 先秦圣谚

最近在Greenplum 6X上发现了一个内存泄漏,Memory Leak DynamicBitmap Index Scan in Nestloop’s inner plan #14122, 查询和查询计划与和之前修复过的如出一辙,所以肯定是来了新的泄漏。这一次可以复现问题,能复现的bug,修复只是时间问题,我的同事此刻已经搞定了,开出了Pull Request (见Issue页面)。本文是我做事后诸葛亮,看看能否用一些工具快速定位这个问题。

Continue reading