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”.
I fail to be surprised. A lot of MySQL/MariaDB can be cleaned up and made simpler without sacrificing performance.
New #mysql planet post : Which is bigger: MySQL or PostgreSQL? http://t.co/P2UpP0DBuK
totally agree
Kostja Osipov liked this on Facebook.
Valerii Kravchuk liked this on Facebook.
Andrew Hutchings liked this on Facebook.
When I compiled MySQL in past on my laptop it needed round about 45 minutes. When I compiled PostgreSQL same way (same j) it just needed 10 minutes.
My guess: C versus C++ complier.
compiler even.
You got it! :-)
Additionally, there were tons of more compiler warnings in MySQL and when you look into both codes you will get the feeling that postgresql code is proper / cleaner – the developers follow the coding guideline and the reviewers really take care that guideline is followed.
funnily enough, I have an internal metric for Drizzle code for its origins and age based on certain bits of code style.
you know what I mean or? When you send a patch to PG and the open brace is at the end of the line – you will get it back with the comment that you should change it that way that the open brace will be in new line. Stuff like this – PG reviewers are very strong here – when you ever saw code where reviewers are softer you will understand the advantage of beeing strong with coding guideline
It might be caused by how caching is done. PostgreSQL relies more on the OS caching.