The Governor Limit and Savepoint (Salesforce Apex)
Savepoint you set counts against the governor limit for DML statements and rows. Also, rollback is also the same. Rows are the number of records. Savepoints and rollbacks were also counted in records. // // Execute Anonymous 1 // Insert 2 times, SavePoint, Rollback total 4 times. // Result, one record of X company is inserted. // Account a1 = new Account(Name = 'X Company '); insert a1; System.SavePoint sp = Database.setSavePoint(); Account a2 = new Account(Name = 'Y Company'); insert a2; Database.rollback(sp); // Debug log Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 4 out of 150 <--- counts Number of DML rows: 4 out of 10000 <--- same counts because inserted every record Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of