Speed up packing using cursor.fetchmany().