From my previous posts, we have some numbers (excluding NDB) for the size of MySQL, so what about PostgreSQL? Here, I used PostgreSQL git trunk and classing things in the contrib/ directory as plugins. I put the number of lines of code in the src/backend/storage directory down as storage engines LoC but did not count it as non-kernel code.
|Version||Total LoC||Plugin LoC||Storage Engines LoC||Remaining (kernel)|
|MySQL 5.5.30||858,441||2,706||171,009||684,726 (79% kernel)|
|MySQL 5.6.10||1,049,344||29,122||236,067||784,155 (74% kernel)|
|MariaDB 5.5||1,142,118||11,781||304,015||826,322 (72% kernel)|
|Drizzle trunk||334,810||31,150||130,727||172,933 (51% kernel)|
|PostgreSQL trunk||648,691||61,934||17,802||586,757 (90% kernel)|
What we can see is that the PostgreSQL kernel size is actually smaller than any recent MySQL version (5.1 was slightly smaller). This is rather interesting as it is generally thought that PostgreSQL does more than MySQL. What’s more telling is that total code size, PostgreSQL is about half of MySQL 5.6 or MariaDB 5.5. Only Drizzle ends up being smaller, which makes sense as it “does less”.