Jump to content

Recommended Posts

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....

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/175579-2-million-rows-and-counting/
Share on other sites

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.