Categories

Calendar

February 2018
M T W T F S S
« Jun    
 1234
567891011
12131415161718
19202122232425
262728  

超级技术坑:MySQL Co-Founder Monty Widenius Quits Sun

Sun 收购 MySQL 也算 2008 年 IT 界的一件大事了。现在 MySQL 的最初作者 Michael ‘Monty’ Widenius 离开了 Sun ,去创办了自己的 Monty Program Ab 公司。抛开其他的影响不说,就这个事情在 Reddit 上有引发了一个超级技术坑,坑的标题如下:

DELETE FROM employees WHERE COMPANY = 'Sun Microsystems' AND POSITION = 'MySQL founder';

一条 SQL 语句道明了整个事情,用来纪念这位 MySQL 的创始人似乎正合适。不过后面的一条回复更是一针见血:

Unfortunately because POSITION was declared as an int field, and because in MySQL, the expression comparing unrelated data types, 0 = ‘MySQL founder’ is true, this has resulted in maximum deletion of numerous employees.

The many deleted employees were not available for ROLLBACK as InnoDB tables were not used, but at least “it all went very fast” as one survivor said.

可以说是一帖总结了 MySQL 的“精华”了。后面一人跟贴道:

god, you have summed up the past eight years of my development life in one reddit post.

I feel so.. so cold

后面大家就开始讨论各种技术问题,有人对“为何所有公司的雇员都放在一个表中”感到不满,还有人觉得 schema 设计得不够好,之后就有人给出了 normalize 过后的版本:

DELETE FROM employees WHERE ID IN 
(
SELECT EmloyeeID FROM Rel_CompEmployee 
INNER JOIN Companies ON Companies.ID = Rel_CompEmployee.CompanyID
INNER JOIN employees ON employees.ID = Rel_CompEmployee.EmployeeID
INNER JOIN Positions ON Positions.ID = employees.PositionID
WHERE Companies.Name = 'Sun Microsystems' AND Positions.Name = 'MySQL founder'
);

当然也有严重跑题,开始讨论变量名的命名方式的;还有 PostgreSQL 的粉丝们跑过来队形非常整齐地贴出了 http://www.postgresql.org/ ;还有 xkcd 的那个漫画也被人翻出来了(我之前也贴过)。总之许多帖子都非常简短,但是却非常有趣,笑过之后,又能感受到写下那短短几个字的作者的雄浑的内力似乎还迟迟未散去。

1 comment to 超级技术坑:MySQL Co-Founder Monty Widenius Quits Sun

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>