I do not think there is any maximum # of rows. As I have have use queries with it well over 35k rows. It would be dependant on the size of fields in each row and the amount of memory you have.
In this case I think you query is simply running out of memory. Try using a cursor in your SQL or use the fetch_row which might be faster anyway than a fetchall_arrayref for a large table like that.
