3

I have a 50 gb data in my org for one object. My triggers will fire and upsert a record on it, does the volume of data show any impact in performing the UPSERT DML operation.

2 Answers 2

4

It will have approximately the same performance as it would to query the records by External ID and make the decision manually. In other words, there's no performance benefit from not using upsert. This is because External Id is indexed, so records can be identified very quickly.

2
  • In the large data volume documentation it says that it does.... does this apply to APIs only or apex as well? developer.salesforce.com/docs/… Sep 17, 2022 at 14:58
  • @PartOfTheOhana It depends on what you're doing. Yes, insert and update individually on their own are faster, but upsert is efficient in terms of API usage when you don't know if the records exist ahead of time, and is usually more efficient than a SOQL+insert+update sequence. Ultimately, YMMV in regards to upsert, but the penalty for using it is usually acceptable when you don't know ahead of time if the records exist.
    – sfdcfox
    Sep 17, 2022 at 19:55
1

You can put a system.debug() statement before and after the DML statement. Then you can test in the production database and in an empty sandbox. The log file will show you for sure if there's a difference. Be sure to test a few times and take an average.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .