讀完 MySQL vs PostgreSQL 有感。

Quote: “InnoDB has a sufficiently large buffer pool, many of the UNDO pages will be modified in memory and freed before they need to be written to the tablespace. This can result in a significant IO reduction, as well as simplified house keeping against fragmentation.”

MySQL InnoDB 因 UNDO 的設計,可以有效降低 Disk IO 的壓力 (通常資料庫效能不是卡在 CPU 或 Memory,而是 Disk),同時資料清理也可以避免碎片化問題 (碎片化會引入空間浪費及效能低落)。

PostgreSQL 非採 UNDO 設計,而是 VACUUM。但 VACUUM 有時很耗 Disk IO,反而讓資料庫效能提早遇到瓶頸。

但 InnoDB UNDO 的缺點是,transaction rollback 的速度很慢。因此若應用場景很常遇到 transaction rollback,則應當考慮使用 PostgreSQL。

結論與我簡報提出的看法一致 http://www.slideshare.net/yftzeng/mysql-postgresql