Book Image

Learning Apex Programming

5 (1)
Book Image

Learning Apex Programming

5 (1)

Overview of this book

Table of Contents (17 chapters)
Learning Apex Programming
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

How many times and how many things


While we cannot stress enough that the limits we are discussing will change in the future, we still want to discuss the types of limits we tend to see in Apex. Since the reason behind the limits is to ensure equal performance for all customers on the server, there tends to be limits on how many times you can perform some operations and how many records you can perform on.

To date, there has always been a limit on the number of records that can be returned by queries, the number of records that can returned by searches, and the number of records you can save in any Apex transaction. Limiting the number of records you can operate on ensures that you write your code to only operate on the records that need to be operated on. This greatly improves the overall performance because you can't write inefficient code that operates on all records every time it is executed. The following code block further elaborates on the previous example to ensure that we only operate...