highscalability.com and some funny comments they make

1-
One of them which is posted on: (Until now at least 9/4/2008)
http://highscalability.com/digg-architecture

In the “Lessons Learned” section says:
Tune MySQL through your database engine selection. Use InnoDB when you need transactions and MyISAM when you don’t. For example, transactional tables on the master can use MyISAM for read-only slaves.

InnoDB tables are mostly faster than MyISAM. The only thing MyISAM supports is full-text search which is crappy and slow on large datasets anyway.

2-
On the same page:
They moved nearly all work out of the database and into applications, including joins, an operation we normally think of as the job of the database.

a) If you want to join tables from your PHP scripts, that means putting a query in a loop and that means sending a query 10, 15 or 20 times to MySQL and get the results and put the results together some how.
This is slow your application down dramatically…
On the other hand, you can let MySQL handle; MySQL is written in C which is a lot (I mean a lot) faster than PHP; it is also designed to do joins and things like that and knows how to optimize your joins; it is made to be fast!
(This also applies to most database servers)

b) If you want to move sorts to PHP, then you are in so much trouble, say you have 1,000,000 users in a table and you want to get your latest 10 users sorted by username, do you know what you have to do?
You have to load all 1,000,000 users to an array in PHP and then use a usort with a custom function that compares the usernames and the problem with this is that PHP will probably run out of memory in the first place and if not, it will take a long time.

If you follow these 2 “lessons” you will make web applications that suck so bad that you either have to rewrite them or add 1 server per 10 extra users per second…

Leave a Comment for highscalability.com and some funny comments they make