$stmt = $pdo->prepare('SELECT * FROM large_table'); $stmt->executeAsync(); PDO v2.0 allows you to stream query results directly to a file or other output stream.