in reply to Is a hash faster?

It depends.

Is your result set large? If so, fetching everything in at once (fetchall_arrayref()) will eat up a lot of memory.

Do you need to work with all of the results at once? If so, and you can spare the memory, grabbing everything will do.

If you're just going to loop over the results, you're probably better off doing the while and getting things one at a time. (It might even be quicker to bind output variables with bind_params().)

I think the gamble is on whether your loop through one big data structre is more expensive than the repeated calls to fetchrow_hashref().