added sort_by and skip options to poly_db and poly_db_ids