MySQLからPostgreSQLに乗り換えた理由。MySQLより10倍速かったから?!

(Last Updated On: 2018年8月14日)

hackers-jp@ml.postgresql.jp に掲載されていたメールの話です。
色々興味深いです。

MyISAM -> InnoDBで容量が約10倍。InnoDBとPostgreSQLを比べても約3倍。
キャパシティプランニングはDB設計の重要な要素ですが、知らないと困ったことになりますね。

MySQLであまり大きなDBを取り扱ったことが無かったので知らなかったですがMyISAM->InnoDBで10倍にもなるケースもあるとは…

JPUGのMLに書かれていた以外の理由としては1/3のメモリで3倍速く、データのパーテションニング、パーシャルインデックス等のPostgreSQL機能を近い将来利用する事が出来ることもスイッチする理由だそうです。

For an application like FeedLounge, the faster counting and smaller row size of PostgreSQL are compelling reasons to use it instead of MySQL with InnoDB tables. Add that it runs in 1/3 the time, using 1/3 the memory (making it essentially 10x faster for us) and that we can start taking advantage of other Postgres features, like data partitioning and partial indices in the near future, and you have the reason we decided to make the switch.

軽くて速いPostgreSQLは彼らにとって「10倍速い」と言っています。何だか一般的に言われていること(MySQLは軽くて速い)と反対ですね。

どのDBを選択するか?は利用条件、要求事項によって最適な選択が異なります。MySQLの方が自分にとっては「10倍速い」と考えるユーザも多いと思います。どちらにしてもこの事例は参考になります。

以下、メール本文のコピーです。

—–
寺本@横須賀 です。

最近メールがないので…
雑談ですが、ちょっと面白いのでご紹介です。(via Planet Postgresql)

FeedLoungeという、RSSフィードのオンラインリーダーを提供している(らしい)サービスがあるのですが、そこがDBをMySQLからPostgreSQLに乗り換えた、という話です。

http://feedlounge.com/blog/2005/11/20/switched-to-postgresql/

何が理由で乗り換えたのかに興味があったので読んでみたんですが、

—-

Some of the reasons we decided to make the switch to PostgreSQL:
 * Database size - when we switched from MyISAM tables to InnoDB tables
   in MySQL, the size of our database grew from ~1GB to 10+GB! When we
   made the switch this weekend, the MySQL InnoDB database was using
   34 GB, and the same data in a PostgreSQL database is only 9.6 GB
   - this should keep our hardware costs down a bit.
 * Load time - The current MySQL setup takes over a day to restore the
   current database, the load of the data into the PostgreSQL database
   took just over 4 hours.

—-

という今まで聞いたことも無い理由で乗り換えたとのことでした。
# PGよりも3倍も容量が多くなっちゃったなんて!

その後にPG派とMy派でいろいろコメントがついてます。
どうもでっかいPrimary Keyがついてるらしく、それがまずいんじゃないのか?的話になっていうように読めました。(斜め読みです)

— Junji Teramoto / teramoto.junji (a) lab.ntt.co.jp Master Yoda : Don’t think…feel…be as one with the Source. Help you, it will.

投稿者: yohgaki