GitlabがMySQLのサポートをやめてPostgreSQLに絞った理由

GitlabがAzureからGCPに移行した話を紹介したばかりだが、同じようにMySQLへのサポートをやめてPostgreSQLに絞るという記事があった。一体、何が起きているのだろう。

- We can't support nested groups with MySQL in a performant way- We have to use hacks to increase limits on columns and this can lead to - - MySQL refusing to store data- MySQL can't add TEXT type column without length specified- MySQL doesn't support partial indexes- These limitations have already created a number of places where MySQL was already not supported (including with Geo)

Gitlabを動かす上でのMySQLでの制約が列挙されている。1つ目のリンクを辿ると、なんてことないIssueのひとつのように見えるが、ここに「PostgreSQLだったら回避策があるんだけどねぇ」と書かれている。

While for PostgreSQL we have a solution, for MySQL things will be very difficult. MySQL doesn't support WITH until version 8, stored procedures can only return 1 row (requiring the use of temporary tables, which are annoying and slow to use1) as far as I can tell, stored procedures by default can not recurse (you need to set either a global or session local stack size), and simply slapping 20 LEFT JOIN statements in the query probably won't scale (and make the output very hard to work with).

MySQLがWITHをサポートするのはVersion8以降だし、ストアドプロシージャも1行しか返さず再帰しない。

In order to work around some of the pain points above, we ended of creating a lot of MySQL-specific code. In some cases this led to merge requests that were twice as complex because they had to support a second database backend. Creating and maintaining this code is a drain on our cycle time and velocity, and it puts a dampener on our value of iteration.

MySQLのための回避策を書いていたが、これに時間がかかり、iterationの価値が削がれる。

Using Usage Ping data we got a clear sense that the vast majority of our customers had already moved to PostgreSQL. We've seen a steady migration to PostgreSQL and recently had less than 1200 GitLab instances reporting their usage of MySQL. At the time there were 110,000 instances using PostgresSQL. Of those still using MySQL the majority were using 11.0 or earlier.

11万を超えるインスタンスがPostgreSQLを使っていて、一方でMySQLは1200程度でかつ古いバージョンを使っている。

画像1

DB-Enginesを見ると、まだまだMySQLの方が人気が高いように見えるが、ここ最近のPostgreSQLの伸びも無視できない。


この記事が気に入ったらサポートをしてみませんか?