fetchAll() loads ALL rows into memory at once, causing memory exhaustion with large datasets.
We can use fetch() instead to retrieve one row at a time, which is much more memory efficient
// 1: use fetch()
$stmt = $pdo->prepare('SELECT * FROM largeTable');
$stmt->execute();
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {