dbsql looping over many rows, with limit