dreamwest Posted September 26, 2009 Share Posted September 26, 2009 I have a database with 2 million + rows and about 70MB in size, i want to move my inserts to another database but still query the original and the new one at the same time i may end up with 20 or so databases this size and still need to simultaneously query them. Is there an easy way to query multiple databases with the same fields?? I can do this as 2 seperate queries but if i can i would like to combine it into one query 2 seperate queries/databases: $con1 = mysql_connect("local", "user", "pass") or die(mysql_error()); mysql_select_db("db1", $con1) or die(mysql_error()); // make another connection for saving purposes $con2 = mysql_connect("local", "user", "pass") or die(mysql_error()); mysql_select_db("db2", $con2) or die(mysql_error()); $result = mysql_query ("SELECT * from sites order by id asc ", $con2) or die(mysql_error()); $num = mysql_num_rows( $result ); etc.... Quote Link to comment https://forums.phpfreaks.com/topic/175579-2-million-rows-and-counting/ Share on other sites More sharing options...
trq Posted September 26, 2009 Share Posted September 26, 2009 i want to move my inserts to another database but still query the original and the new one at the same time Why? Quote Link to comment https://forums.phpfreaks.com/topic/175579-2-million-rows-and-counting/#findComment-925239 Share on other sites More sharing options...
dreamwest Posted September 26, 2009 Author Share Posted September 26, 2009 i want to move my inserts to another database but still query the original and the new one at the same time Why? Im getting scared! I have no idea how much a mysql table can hold. And my hosting company limits databases over 150MB Quote Link to comment https://forums.phpfreaks.com/topic/175579-2-million-rows-and-counting/#findComment-925262 Share on other sites More sharing options...
PFMaBiSmAd Posted September 26, 2009 Share Posted September 26, 2009 The limits that hosting companies use normally apply to the total of all the databases, not to each database, because what matters to them is the total amount of storage you are paying for. It is likely that splitting data between multiple databases won't accomplish anything relative to your web hosting restriction and it will make the queries take x times longer, where x is the number of different databases that are being queried to find any piece of information. Quote Link to comment https://forums.phpfreaks.com/topic/175579-2-million-rows-and-counting/#findComment-925298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.