[SalesForce] Database Class Methods

A noobie question.

Is Database.Update bulkified by itself ?.

I know it is similar to "update" but just wanna confirm that this alternate version of DML is auto bulkified.

For example let us assume that my_sobject_array collection has 4000 records.

When I execute the following statement

Database.SaveResult[] result = Database.Update("my_sobject_array",false);

It will not hit any governor limits as it will complete this DML operation in pieces. Am I right ?

Best Answer

Any DML execution in SFDC is always split up into chunks of 200. Each chunk is then processed separately by code.

However, that is not related to governor limits. Governor Limits are applied against a complete transaction. A transaction can contain multiple insert, updates, deletes, etc. All the stuff you do in the transaction is added together to measure up against the Governor Limits.

So whether or not you will hit governor limits when updating 4000 records at once depends on what other actions are in your transaction and on what other actions are triggered by your update.

E.g. just updating 4000 records without hitting any other workflow and/or triggers will not be a problem.