Each execution of a batch Apex job is considered a discrete transaction. … If you specify Database.Stateful in the class definition, you can maintain state across these transactions. When using Database.Stateful, only instance member variables retain their values between transactions.