in reply to Re^2: Why a reference, not a hash/array?
in thread Why a reference, not a hash/array?

My understanding on this isn't the most solid, but I believe it depends on the DB itself and the optimization of the DBD driver.

So, for example, you call execute() and DBI talks to the DB via an API to fetch the data into memory - the DB software's memory. When your perl app needs that data, you would call something like fetchrow_hashref(), which then makes the API call to retrieve each successive row's data from the DB to perl.

So, the short answer is: When you use DBI like the docs recommend, the data is where you need it when you want it, without cluttering up the heap. (keeping your RAM usage lower)
  • Comment on Re^3: Why a reference, not a hash/array?