Limit the number of lines read from the database