You need to sign in to do that
Don't have an account?

Governor Limit on Upsert
I would like to write an Apex class to read records from a custom staging object (50,000+), upsert them into another custom object, and delete them from the staging object. Is this possible or will I hit governor limits? I would like an administrator to be able to kick this process off from a Visual Force page button. I can't figure out the governor limits.
I think you could accomplish this using a Visualforce page and an Apex controller. The key is to chunk the transactions to avoid hitting a governor limit. Here is how I see the flow:
a. User hits button on visualforce page, calls a method in the apex controller
b. That method simply enables a boolean to state that the batch process has started. Return back to the current pageReference.
c. The boolean set to true in the previous step will enable an ActionPoller component.This is an interval based VF component that will call an apex action method every X seconds (must be greater than 5). This is the key. Each time the Apex method is called, governor limits are enforced. For an apex controller, you can query 10,000 records and insert/update 10,000 records. So make sure this apex method only processes a certain set of datal
d. If the data is done being processed, set a boolean to false to disable the ActionPoller and display a message on the VF page to the user that the processing is done.