4 ms·
Most of the methods people use for sharding/partitioning end up in the application layer, because open-source DBs just aren't fancy enough yet to handle this.
by dzohrob 18y ago
Most of the methods people use for sharding/partitioning end up in the application layer, because open-source DBs just aren't fancy enough yet to handle this.
Mysql-proxy (http://forge.mysql.com/wiki/MySQL_Proxy http://forge.mysql.com/wiki/MySQL_Proxy) looks promising, but it's still in an alpha state. You could try writing a proxy script in Lua -- there's already some master /slave stuff done in this area.
Mysql 5.1 supports partitioning, but not really in the way that you and I mean.
The problem is that sharding breaks some fundamental SQL axioms -- for example, doing SELECTs no longer returns all rows (depending on how the table is partitioned).
Almost everyone I know who does this rolls their own layer. As subwindow mentioned, if you're using Rails, you have to futz with establish_connection due to ActiveRecord's assumptions about one DB connection per class. It's possible -- we've done it -- but it requires lots of connections to the DB and it can be messy. If you're on Rails, it might be easier to scale vertically first before going horizontal.
Replication doesn't need to change in this context -- the Mysql documentation should be all you need to get started.