function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dev_AryaDev_Arya 

Bulk Delete operation in trigger does not split data in chunks of 200

Hi Reader,

As far I know, while processing bulk operations in Trigger, the data is split in chunks of 200 per batch. I have around 40K accounts in org and I wanted to delete around 1000 of them. To understand limits, I wrote a simple after trigger with limits check in it.
trigger Account_After on Account ( after delete, after insert, after undelete, after update ) {
    if(Trigger.isDelete){        
        System.debug('Number of records executed in this batch: ' + Trigger.old.size());
        System.debug('Returns the total number of SOQL queries that can be issued.: ' +  Limits.getLimitQueries());
        System.debug('Returns the number of DML statements (such as insert, update) that have been called.: ' + Limits.getDMLStatements());
        System.debug('Returns the number of SOQL queries that have been issued.: ' + Limits.getQueries() );
    }
}
I executed the code anonymous:
List<Account> A = [Select Id from Account LIMIT 1000];
Database.Delete(A, false);
I expected, this trigger to run 5 times in batch of 200 each; however the output I received was one batch with 1000 records.
15:35:05:125 USER_DEBUG [95]|DEBUG|Number of records executed in this batch: 1000
15:35:05:126 USER_DEBUG [96]|DEBUG|Returns the total number of SOQL queries that can be issued.: 100
15:35:05:126 USER_DEBUG [97]|DEBUG|Returns the number of DML statements (such as insert, update) that have been called.: 1
15:35:05:126 USER_DEBUG [98]|DEBUG|Returns the number of SOQL queries that have been issued.: 3

Why the records got deleted in one batch, or my understanding of bulk trigger is wrong?

Thanks. Cheers.