开发者

DB Cursor fetching in Web Applications

I never understood this: in web development whe[n|re] does it make sense to fetch results one by one?

I mean, why shou开发者_开发问答ld I use PDOStatement->fetch*() when I can use PDOStatement->fetchAll()?


fetchAll() will fetch all the results into one big array.

With very large result sets, it could exceed the PHP script's memory limit.

A pure fetch() will fetch each record one by one, neutralizing that danger.

That's the only reason not to use fetchAll() I can think of.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜