I am new to PHP programming, so I am having this basic(may be stupid) question regarding MySQL connections in PHP.
Suppose we make a basic query like ‘select * from users’ and there are millions of rows in the table users. Would the PHP code load the SQL data rows lazily in the memory i.e. loading the rows according to the way they are accessed in the code or all the rows are dumped directly into the memory?
Thanks for the help.
This depends on if you use a buffered query or unbuffered query. With a buffered query, PHP does retrieve the whole result set. With an unbuffered query it allows you to retrieve it one row at a time.
Please see here for more info.