optimize this script to run a lot faster-simple
$30-250 USD
Pagado a la entrega
okay so there is a 100 million rows in my database what i need is this script to run faster right now it queries the database for each file it creates .. it takes about two and half hours is there any options to query the database only once?Maybe put it in an array or something
I need this done right now max pay is $50.
Look below
<form method="get">
<input type="text" name="where" value="">
<input type="submit" value="Submit">
</form>
<?php
$check4empty = true;
if(!isset($_GET['where']))
exit;
$where = $_GET['where'];
$host = "localhost"; // host name
$user = "xx"; // database user name
$pass = "xx"; // database password
$database = "xxxx"; // database name
$connect = @mysql_connect($host,$user,$pass)or die (@mysql_error());
mysql_select_db($database,$connect) or die (mysql_error());
// changes by pradeep
$results = mysql_query("SELECT count(*) as total FROM `$where`");
print mysql_error();
$values = mysql_fetch_assoc($results);
$num_rows = $values['total'];
$ii = 0;
$filenameCounter = 1;
while ($ii < $num_rows)
{
$ourFileName = "map/$where".$filenameCounter.".xml";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fwrite($ourFileHandle, '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="[login to view URL]">');
$query = mysql_query("SELECT * FROM `$where` ORDER BY domain ASC LIMIT ".$ii.",50000");
while ($row = mysql_fetch_assoc($query)) {
$id = $row['domain'];
fwrite($ourFileHandle, '<url>
<loc> [login to view URL]'.$id.'.'.$where.'</loc>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
');
}
fwrite( $ourFileHandle ,'</urlset>') ;
fclose($ourFileHandle);
$ii = $ii + 50000;
$filenameCounter++;
}
// end changes
echo "$where";
?>
Nº del proyecto: #6344741
Sobre el proyecto
Adjudicado a:
I can optimize it < 30 min for sure. With mysql export and cursor file alocation i can create you XML files you want. Im working with big data for several years now. Thnx
8 freelancers están ofertando un promedio de $87 por este trabajo
---------------------------------------------------------------------------------------------------------------------------------------
Hello I will do this job perfectly by optimizing the database. Ready to start quality work immediately Regards Nikhil
Hello Sir, Let me help you with your task . I have over 3+ expericene working with webapps with large database just like yours and i can help optimize it