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:xampphtdocscombina.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');
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…