I am trying to combine 2 existing MySQL MyISAM tables into a new one using PHP. Here is my PHP code:
$sql = "CREATE TABLE new_table SELECT * FROM table_1 UNION SELECT * FROM table 2";
mysql_query("$sql");
Note: the tables are fairly huge, with over 30 million entries.
So I open the PHP file in the browser so that it executes the script. And I monitor the database with phpmyadmin and at first absolutely nothing happens. Then after about 30 minutes the table "new_table" shows up with all the correct data inside.
Is PHP buffering or caching "new_table" untill its complete and then creating it in MySQL? If so, is there any way to tell php not to? I am afraid that if this is the case, once the table reaches into the billions of rows it will no longer fit into the buffer when I try to copy it.
Does anyone know how to make PHP do the query immediately without and buffer or cache delay?
I tried mysql_unbuffered_query("$sql"); and still had the huge delay.
Any help would be greatly appreciated!