As far as I know, mysqli has two options for the operation of SELECT queries: when data from the database is sent immediately in an array, and when the data cache is stored in the database and sent in parts. I did not use mysqli directly - I worked with a wrapper class around this module and did not pay attention. I decided to poke around with the PDO - immediately there was a problem with getting a lot of data - an overflow error occurred in the allocated space for the script. I would like to know how to implement the data acquisition from the database in parts. If someone starts proposing alternatives, I immediately say that I am aware of them (the simplest thing is to change the logic so that it would not work with such amount of information), so I would like to get an answer to the question with my preferences.

  • The option to select select * from somethink limit x, n where x = i * n and processing it in a loop, do you regard as an alternative? - Chad

1 answer 1

It seems to me that setFetchMode(PDO::FETCH_LAZY) will help you?

Read more in the manual