We have to loop through a database table and get all the attachments from the db

We have to loop through a database table and get all the attachments from the db to Appian KC/Folder.
We have used query database and it returns very few rows.
What is the best way to loop through a table containing 1 lac rows.

Your inputs are highly appreciated!!!

OriginalPostID-168724

OriginalPostID-168724

  Discussion posts and replies are publicly visible