Jump to content
MakeWebGames

Damn Database size


Recommended Posts

I decided to put this in mysql as it was more mysql than php so here it is:

I currently generate all possible combination of letters and numbers going up in base 36. Generating 20,000 entries into the database per minute. I had a script:

<?PHP
require "mysql.php";
global $c;
$nu=mysql_query("SELECT * FROM md5 WHERE done=1",$c) or die (mysql_error());
$no=mysql_num_rows($nu);
mysql_query("UPDATE total SET total=$nu WHERE id=1") or die (mysql_error());
print"There are currently $nu encryption's on the database.";
?>

This was working fine until I reached over 2,500,000 encryptions. Then I got this result:

Warning: mysql_query() [function.mysql-query]: Unable to save result set in /home/thecrime/public_html/md5/totalcron.php on line 5

MySQL client ran out of memory

I then tried:

<?PHP
require "mysql.php";
global $c;

$nu=mysql_query("SELECT COUNT(*) FROM md5",$c) or die (mysql_error());
echo"$nu";
mysql_query("UPDATE total SET total=$nu WHERE id=1") or die (mysql_error());

?>

And I got the output:

Resource id #4

plus the error of trying to write this as a number.

Does anyone know how to count the rows using another method? I think the reason it is not working is something to do with my database size:

largedb.PNG

Link to comment
Share on other sites

Re: Damn Database size

 

<?PHP
require "mysql.php";
global $c;

$nu=mysql_query("SELECT COUNT(*) FROM md5",$c) or die (mysql_error());
$x = mysql_fetch_array($nu);
echo $x[0];
mysql_query("UPDATE total SET total=$nu WHERE id=1") or die (mysql_error());

?>

 

That's using count, dunno why you'd want 2.5mil records in files

Link to comment
Share on other sites

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.   Paste as plain text instead

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