Mysql – How to determine that the maximum size of the database file is exceeded, and switch the data insertion to the second server

MySQLpartitioningPHP

First I`m sorry for my bad English.

My problem is I have one virtual server with PHP backend and one server with one single-table MySQL database. I don't want the file size of the database to exceed 2 gigabytes. I want to switch the data insertion to the second server after the first one will be overflowed, then to the third server after the second one, etc.

How to determine that the maximum size of the database file is exceeded, and switch the data insertion to the second server?

Thanks for advance.

Best Answer

Usually it would be slower to do what you suggest.

Case 1 -- big disk. With a good index, the time it takes to fetch a row is almost the same for a huge table as for a tiny table.

Case 2 -- table is split across multiple servers. Now you have to try the query on one server, then move to another. This seems like a lot more work.

Lets be specific... Please show us the query that you are trying to optimize. And show us SHOW CREATE TABLE. There may be a simple way to make it run fast, regardless of the 2GB boundary you propose.