I am trying to learn how to deal with lots of data… so I have inserted over 4 million rows into a MySQL table with an unique and with random numbers. I want to use php to find out a rank of an unique row based on the number of votes they get.
And when I retrieve the data from the MySQL database I obviously get the ‘error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in …’ on line’ error.
This is the code that I use to get the error:
[php]$sth = $this->db->query("SELECT votes FROM list ");
$this->toplistItems = $sth->fetchAll(PDO::FETCH_ASSOC);[/php]
How can I deal with large amounts of data?
And yes… i know that I can increase the allocated memory… but let’s say that I can’t.
Thank you in advance.