If you only want the last element of a result set, there's no need to create all of hash_rows. Also, add a test.