Sample Header Ad - 728x90

Distribute records on different MySQL databases - MySQL Proxy alternative

2 votes
1 answer
490 views
My scenario is the following: Right now I am using one big MySQL database with multiple tables to store user data. Many tables contain auto increment columns. I would like to split this into 2 or more databases. The distribution should be done by user_id and is determined (cannot be randomized). E.g. user 1 and 2 should be on database1, user 3 on database2, user 4 on database3. Since I don't want to change my whole frontend, I would like to still use one db adapter and kind of add a layer between the query generation (frontend) and the query execution (on the right database). This layer should distribute the queries to the right database based on the user_id. I have found MySQL Proxy which sounds exactly like what I need. Unfortunately, it's in alpha and not recommended to be used in a production environment. For php there is MySQL Native Driver Plugin API which sounds promising but then I need a layer that supports at least php *and* java. Is there any other way I can achieve my objectives? Thanks!
Asked by horen (129 rep)
Mar 25, 2014, 08:47 AM
Last activity: Mar 3, 2025, 02:05 PM