UpSertData is call to the api where it pushes the data to the api for uploading and inserting @rrk Can you explain what you mean by putting it separate, how that can help?, its already doing a batch upload
If the "upsert" is happening in the same database, then running a query to read data from one table and update another is infinitely faster done directly on the database.
SQL update from one Table to another based on a ID match
Example from that answer:
UPDATE
Sales_Import
SET
Sales_Import.AccountNumber = RAN.AccountNumber
FROM
Sales_Import SI
INNER JOIN
RetrieveAccountNumber RAN
ON
SI.LeadID = RAN.LeadID;
If the data is coming from your system and being sent to another system's API, it may be better to send that data over one record at a time or fewer at a time. You can create a Scheduled Task in CF Admin that pings your script every minute or so, sending a much lower volume of data at a time. It will take more requests, but could likely complete in a much more timely manner than trying to shove a large volume of data over at once.
For example, I had a product sending over 10k records to mine at a time. It would often timeout, failing to sync data. That product was already sending single record updates to a microservice, so we updated my product to subscribe to the same microservice. I would get individual record updates, but my system (CF based) could process 10k requests quickly and without fail, as opposed to trying to process (and often failing to process) one large request.