I have a Mysql table (named "base") with 3 million records, which is composed of only 3 int(10) fields.
When I try to run this simple query $result = mysqli_query($db, 'SELECT * FROM base')
, php shows the error:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485768 bytes) in C:\xampp\htdocs\combina.php on line 17
I think mysqli_query should not load all the table records into memory, right?
So why the memory overflow?
I'm using XAMPP installation on Windows 10, PHP 7.2.
Here is the code:
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "comb";
$db = mysqli_connect($servername, $username, $password, $dbname);
if (!$db) {
die("Falha na conexão: " . mysqli_connect_error());
}
$result = mysqli_query($db, 'SELECT * FROM base');
$result = mysqli_query($db, 'SELECT * FROM base')
? – user3783243fetch
though? – user3783243mysqli_query($db, 'SELECT * FROM base')
. I did not understand your question. – Rogério Dec