PHP / JavaScript / TypeScript Exercise Question 1 fetchAll() loads the whole result set into PHP memory before the loop starts. With a large table this can easily exceed the configured memory limit. I would process the rows one at a time instead: $stmt = $pdo->prepare('SELECT * FROM largeTable');