in reply to perl dbi : fetchrow_arrayref
There is also a pure-SQL consideration to think about here. “An SQL result-set can be arbitrarily large.” Also, it is often the case that an application does not actually examine all the rows; only the first few. The designers of database engines seek to exploit (and to compensate for) these factors.
What DBI encapsulates for you is formally known as a cursor, which is a window into the result set of the query. Depending on the circumstances (the database, the driver, how the query was set up, and so on) that cursor may or may not be updatable and it may or may not be scrollable in the reverse direction.
It is often desirable to arrange that your query be as specific as possible (yielding the smallest recordset); that it do whatever sorting needs to be done on the server; and that you do not need to “back up” while moving through it.