{"id":20333,"date":"2026-08-19T12:25:35","date_gmt":"2026-08-19T12:25:35","guid":{"rendered":"https:\/\/dianapps.com\/blog\/?p=20333"},"modified":"2026-08-19T12:25:49","modified_gmt":"2026-08-19T12:25:49","slug":"salesforce-governor-limits","status":"publish","type":"post","link":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/","title":{"rendered":"Salesforce Governor Limits: Full Reference and How to Fix Them"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Governor limits are the reason code that works perfectly in a sandbox falls over in production.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The two everyone knows, 100 SOQL queries and 150 DML statements, are the easy ones. They have an obvious cause and a five-minute fix; the ones that cost real time are CPU time exceeded and heap size too large, because neither has a single offending line. They\u2019re accumulated inefficiency, and most guides don\u2019t cover them at all.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This is the full reference, plus the fixes for the errors you\u2019re actually seeing.<\/span><\/p>\n<blockquote><p><b>Quick Answer:<\/b><span style=\"font-weight: 400;\"> Limits are per transaction, and everything firing on that save shares them: your trigger, other triggers, Flows, validation rules, managed packages. Sync gets 100 SOQL \/ 150 DML \/ 10 seconds CPU \/ 6MB heap. Async roughly doubles CPU and heap but not SOQL rows or DML. When you genuinely can\u2019t optimise further, Batch Apex resets the limits per chunk; that\u2019s the escape hatch.<\/span><\/p><\/blockquote>\n<h2><b>Why Governor Limits Exist<\/b><\/h2>\n<p><b>Salesforce Is Multi-Tenant<\/b><span style=\"font-weight: 400;\">: Your org shares infrastructure with thousands of others on the same instance. Limits stop any one tenant from monopolising shared resources.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The Practical Consequence: A governor limit exception cannot be caught and handled. When you hit one, the transaction throws a runtime exception and rolls back entirely. There\u2019s no degradation, no warning, no partial success. That\u2019s why limits shape architecture rather than sitting in a performance-tuning backlog.<\/span><\/p>\n<h2><b>The Full Reference Table<\/b><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20342\" src=\"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_24_20-PM.webp\" alt=\"Salesforce Governor limits: the real numbers that actuallhy matters\" width=\"1536\" height=\"1024\" srcset=\"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_24_20-PM.webp 1536w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_24_20-PM-1024x683.webp 1024w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_24_20-PM-768x512.webp 768w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_24_20-PM-640x427.webp 640w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_24_20-PM-400x267.webp 400w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/p>\n<p><i><span style=\"font-weight: 400;\">Table of Salesforce governor limits showing synchronous and asynchronous values for SOQL queries, records retrieved, SOSL, DML statements, records per DML, CPU time, heap size, callouts, future calls, queueable jobs, and stack depth<\/span><\/i><\/p>\n<p><b>Two things to read from that table.<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Async Doesn\u2019t Double Everything:<\/b><span style=\"font-weight: 400;\"> CPU time goes from 10 to 60 seconds and heap from 6MB to 12MB &#8211; a genuine difference. But SOQL query rows stay at 50,000, and DML statements stay at 150. Moving work async solves CPU and heap problems; it doesn\u2019t solve volume problems.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Batch Apex Is Different Again:<\/b><span style=\"font-weight: 400;\"> Limits reset for every chunk of 200 records, which is why Batch is the answer to \u201cI need to process everything\u201d rather than Queueable.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Beyond per-transaction limits, there are also static limits (Apex code size, currently 6MB per org), Lightning Platform limits (API calls per 24 hours, based on edition and licence count) and size-specific limits. Most of those are soft and can be raised by Salesforce Support. The per-transaction ones above are hard.<\/span><\/p>\n<h2><b>Everything on One Save Shares One Budget<\/b><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20343\" src=\"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_25_46-PM.webp\" alt=\"Diagram showing that one transaction budget is shared across your Apex trigger, other triggers, record-triggered Flows, validation rules, managed packages and Process Builder remnants\" width=\"1536\" height=\"1024\" srcset=\"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_25_46-PM.webp 1536w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_25_46-PM-1024x683.webp 1024w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_25_46-PM-768x512.webp 768w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_25_46-PM-640x427.webp 640w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_25_46-PM-400x267.webp 400w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/p>\n<p><i><span style=\"font-weight: 400;\">Diagram showing that one transaction budget is shared across your Apex trigger, other triggers, record-triggered Flows, validation rules, managed packages, and Process Builder remnants<\/span><\/i><\/p>\n<p><b>This is the part that catches people out:<\/b><span style=\"font-weight: 400;\"> Your trigger isn\u2019t allocated 100 queries. The transaction is, and every automation firing on that record draws from the same pool.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A trigger that passes every test in isolation fails in production because a Flow fires alongside it and a managed package adds three more queries. If you\u2019re debugging a limit exception you can\u2019t reproduce, check what else runs on that object. Flow Trigger Explorer shows every record-triggered Flow on an object in execution order.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Related: <\/span><a href=\"https:\/\/dianapps.com\/blog\/the-ultimate-guide-to-salesforce-flow\/\"><span style=\"font-weight: 400;\">Salesforce Flow<\/span><\/a><span style=\"font-weight: 400;\"> \u00b7 <\/span><span style=\"font-weight: 400;\">Flow vs Apex<\/span><\/p>\n<h2><b>The Errors You\u2019re Actually Seeing<\/b><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20344\" src=\"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_27_17-PM.webp\" alt=\"Table mapping six common governor limit errors to their real causes and fixes\" width=\"1607\" height=\"979\" srcset=\"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_27_17-PM.webp 1607w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_27_17-PM-1024x624.webp 1024w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_27_17-PM-768x468.webp 768w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_27_17-PM-1536x936.webp 1536w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_27_17-PM-640x390.webp 640w, https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/ChatGPT-Image-Aug-19-2026-05_27_17-PM-400x244.webp 400w\" sizes=\"auto, (max-width: 1607px) 100vw, 1607px\" \/><\/p>\n<p><i><span style=\"font-weight: 400;\">Table mapping six common governor limit errors to their real causes and fixes<\/span><\/i><\/p>\n<h3><b>Too many SOQL queries: 101<\/b><\/h3>\n<p><b>Cause:<\/b><span style=\"font-weight: 400;\"> A query inside a loop, 200 records, 200 queries, blown at 100.<\/span><\/p>\n<pre class=\"theme:github nums:false lang:default decode:true \">\/\/ \u2717\r\nfor (Contact c : contacts) {\r\n\u00a0 \u00a0 Account a = [SELECT Name FROM Account WHERE Id = :c.AccountId];\r\n}\r\n\r\n\/\/ \u2713 One query, any volume\r\nSet&lt;Id&gt; accountIds = new Set&lt;Id&gt;();\r\nfor (Contact c : contacts) accountIds.add(c.AccountId);\r\n\r\nMap&lt;Id, Account&gt; accounts = new Map&lt;Id, Account&gt;([\r\n\u00a0 \u00a0 SELECT Id, Name FROM Account WHERE Id IN :accountIds\r\n]);<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">The pattern never changes: collect into a <\/span><span style=\"font-weight: 400;\">Set<\/span><span style=\"font-weight: 400;\">, query once outside the loop into a <\/span><span style=\"font-weight: 400;\">Map<\/span><span style=\"font-weight: 400;\">, loop again to apply.<\/span><\/p>\n<h3><b>Too many DML statements: 151<\/b><\/h3>\n<p><b>Cause:<\/b><span style=\"font-weight: 400;\"> DML inside a loop. Same shape, lower ceiling.<\/span><\/p>\n<pre class=\"theme:github nums:false lang:default decode:true \">\/\/ \u2713 Build the list, one DML afterwards\r\nList&lt;Contact&gt; toUpdate = new List&lt;Contact&gt;();\r\nfor (Contact c : contacts) {\r\n\u00a0 \u00a0 c.Description = 'Updated';\r\n\u00a0 \u00a0 toUpdate.add(c);\r\n}\r\nif (!toUpdate.isEmpty()) update toUpdate;<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">A collection of 10,000 records costs one DML statement. That\u2019s the whole point of bulkification.<\/span><\/p>\n<h3><b>Apex CPU time limit exceeded<\/b><\/h3>\n<p><b>The Hard One: <\/b><span style=\"font-weight: 400;\">There\u2019s no single line to fix; it\u2019s accumulated processing across the entire transaction.<\/span><\/p>\n<p><b>Real Causes, In Rough Order Of Frequency:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Nested loops:<\/b><span style=\"font-weight: 400;\"> Looping a list inside another loop is O(n\u00b2). At 200 records, that\u2019s 40,000 iterations.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Too Much Automation On One Object:<\/b><span style=\"font-weight: 400;\"> Three triggers, four Flows, a dozen validation rules, all counted.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>JSON Serialisation And Deserialisation<\/b><span style=\"font-weight: 400;\"> of large structures.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Describe Calls Inside Loops:<\/b> <span style=\"font-weight: 400;\">Schema.getGlobalDescribe()<\/span><span style=\"font-weight: 400;\"> is expensive; call it once and cache it.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Complex Formula Fields And Roll-Up Summaries<\/b><span style=\"font-weight: 400;\"> recalculating on save.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>String Concatenation In Loops<\/b><span style=\"font-weight: 400;\">: Use a <\/span><span style=\"font-weight: 400;\">List&lt;String&gt;<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">String.join()<\/span><span style=\"font-weight: 400;\"> instead.<\/span><\/li>\n<\/ul>\n<p><b>Fixes:<\/b><\/p>\n<pre class=\"theme:github nums:false lang:default decode:true \">\/\/ \u2717 O(n\u00b2) - nested loop\r\nfor (Account a : accounts) {\r\n\u00a0 \u00a0 for (Contact c : contacts) {\r\n\u00a0 \u00a0 \u00a0 \u00a0 if (c.AccountId == a.Id) { \/* ... *\/ }\r\n\u00a0 \u00a0 }\r\n}\r\n\r\n\/\/ \u2713 O(n) - Map lookup\r\nMap&lt;Id, List&lt;Contact&gt;&gt; byAccount = new Map&lt;Id, List&lt;Contact&gt;&gt;();\r\nfor (Contact c : contacts) {\r\n\u00a0 \u00a0 if (!byAccount.containsKey(c.AccountId))\r\n\u00a0 \u00a0 \u00a0 \u00a0 byAccount.put(c.AccountId, new List&lt;Contact&gt;());\r\n\u00a0 \u00a0 byAccount.get(c.AccountId).add(c);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b>Note that SOQL and DML wait time doesn\u2019t count toward CPU time;<\/b><span style=\"font-weight: 400;\"> only your processing does. If your transaction is slow but the CPU is fine, the problem is query performance, not code. See the <\/span><a href=\"https:\/\/dianapps.com\/blog\/soql-and-sosl-in-salesforce\/\"><span style=\"font-weight: 400;\">SOQL guide<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><b>When you can\u2019t optimise further:<\/b><span style=\"font-weight: 400;\"> move work asynchronously; Async gets 60 seconds instead of 10.<\/span><\/p>\n<h3><b>Apex heap size too large<\/b><\/h3>\n<p><b>Cause:<\/b><span style=\"font-weight: 400;\"> Holding too much in memory at once, usually too many records or too many fields on them.<\/span><\/p>\n<p><b>Fixes:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Select fewer fields:<\/b><span style=\"font-weight: 400;\"> Every field on every record consumes heap.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Use a SOQL for-loop<\/b><span style=\"font-weight: 400;\">: Which processes in chunks of 200 and releases memory between them:<\/span><\/li>\n<\/ul>\n<pre class=\"theme:github nums:false lang:default decode:true\">for (List&lt;Account&gt; batch : [SELECT Id, Name FROM Account WHERE Industry = 'Banking']) {\r\n\u00a0 \u00a0 for (Account a : batch) { \/* process *\/ }\r\n}<\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Mark variables<\/span> <b>transient<\/b><span style=\"font-weight: 400;\"> in Visualforce controllers so they aren\u2019t serialised into view state.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Null out large collections when you\u2019re finished with them.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Move to Batch Apex for genuinely large volumes.<\/span><\/li>\n<\/ul>\n<h3><b>Too many query rows: 50001<\/b><\/h3>\n<p><b>Cause:<\/b><span style=\"font-weight: 400;\"> A query returning more than 50,000 rows across the transaction.<\/span><\/p>\n<p><b>Fix:<\/b><span style=\"font-weight: 400;\"> Add selective filters on indexed fields or use Batch Apex with a <\/span><span style=\"font-weight: 400;\">QueryLocator<\/span><span style=\"font-weight: 400;\">, which handles up to 50 million records.<\/span><\/p>\n<h3><b>UNABLE_TO_LOCK_ROW<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Not strictly a governor limit, but it appears in the same debugging sessions. Two processes updating the same record, commonly a bulk load hitting the same parent account repeatedly or a Flow and a trigger colliding.<\/span><\/p>\n<p><b>Fix:<\/b><span style=\"font-weight: 400;\"> order your data loads to avoid contention, reduce batch size, or move work asynchronously.<\/span><\/p>\n<div style=\"background: #EEF2FE; border: 1px solid #DBE2FB; border-radius: 14px; padding: 28px 32px; margin: 38px 0;\">\n<h4 style=\"color: #1b3fae; font-size: 22px; line-height: 1.3; font-weight: bold; margin: 0 0 10px;\"><span style=\"font-weight: 400;\"><b>Get Your Salesforce Limits Under Control <\/b><\/span><\/h4>\n<p style=\"color: #4b5563; font-size: 16px; line-height: 1.6; margin: 0 0 22px;\"><span style=\"font-weight: 400;\">Get expert help diagnosing governor limit failures, optimizing Apex, reducing automation overhead, and designing transactions that scale safely.<\/span><\/p>\n<p><a style=\"display: inline-block; background: #2563EB; color: #ffffff; text-decoration: none; font-size: 15px; font-weight: 600; padding: 13px 26px; border-radius: 8px;\" href=\"https:\/\/dianapps.com\/salesforce-development-services\">Explore Salesforce Development Services\u00a0\u2192<\/a><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<h2><b>Instrumenting Your Code: The Limits Class<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">You don\u2019t have to guess how close you are; the <\/span><span style=\"font-weight: 400;\">Limits<\/span><span style=\"font-weight: 400;\"> class tells you at runtime:<\/span><\/p>\n<pre class=\"theme:github nums:false lang:default decode:true \">System.debug('SOQL used: ' + Limits.getQueries() + ' of ' + Limits.getLimitQueries());\r\nSystem.debug('DML used: ' + Limits.getDmlStatements() + ' of ' + Limits.getLimitDmlStatements());\r\nSystem.debug('CPU used: ' + Limits.getCpuTime() + ' of ' + Limits.getLimitCpuTime());\r\nSystem.debug('Heap used: ' + Limits.getHeapSize() + ' of ' + Limits.getLimitHeapSize());<\/pre>\n<p>&nbsp;<\/p>\n<p><b>Use it defensively in bulk-processing code:<\/b><\/p>\n<pre class=\"theme:github nums:false lang:default decode:true \">if (Limits.getQueries() &gt; Limits.getLimitQueries() - 10) {\r\n\u00a0 \u00a0 \/\/ approaching the limit - defer the rest\r\n\u00a0 \u00a0 System.enqueueJob(new ContinueProcessingQueueable(remaining));\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b>That pattern<\/b><span style=\"font-weight: 400;\">: Check the budget and hand the remainder to an async job is how genuinely large processing jobs stay inside limits.<\/span><\/p>\n<p><b>For Diagnosis:<\/b><span style=\"font-weight: 400;\"> Enable a debug log with Apex profiling, and the Limits section at the bottom of the log shows exactly what the transaction consumed. That\u2019s faster than adding debug statements when you\u2019re investigating someone else\u2019s code.<\/span><\/p>\n<h2><b>When Optimising Isn\u2019t Enough: Async Strategies<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Some workloads genuinely can\u2019t fit in a synchronous transaction. The escape hatches, in order of when to reach for them:<\/span><\/p>\n\n<table id=\"tablepress-262\" class=\"tablepress tablepress-id-262\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">Approach<\/th><th class=\"column-2\">Gets you<\/th><th class=\"column-3\">Use when<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">Queueable<\/td><td class=\"column-2\">60s CPU, 12MB heap, chainable<\/td><td class=\"column-3\">Moderate work that can happen slightly later<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">Batch Apex<\/td><td class=\"column-2\">Limits reset per 200-record chunk<\/td><td class=\"column-3\">Large volumes - up to 50 million records<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">Platform Events<\/td><td class=\"column-2\">Decoupled, separate transaction<\/td><td class=\"column-3\">Fire-and-forget integration work<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">Scheduled Apex<\/td><td class=\"column-2\">Runs on a clock, usually calling Batch<\/td><td class=\"column-3\">Nightly or periodic processing<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-262 from cache -->\n<p>&nbsp;<\/p>\n<p><b>Batch Apex Is The Important One:<\/b><span style=\"font-weight: 400;\">\u00a0Because limits reset for every chunk, a batch job processing 100,000 records gets 100 SOQL queries <\/span><i><span style=\"font-weight: 400;\">per chunk of 200,<\/span><\/i><span style=\"font-weight: 400;\"> not 100 in total. That\u2019s the difference between impossible and routine.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Full detail: <\/span><a href=\"https:\/\/dianapps.com\/blog\/apex-programming-guide\/\"><span style=\"font-weight: 400;\">Apex programming guide<\/span><\/a><\/p>\n<h2><b>Design Patterns That Keep You Under Limits<\/b><\/h2>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Always assume 200 records; never <\/span><span style=\"font-weight: 400;\">Trigger.new[0]<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">One trigger per object, delegating to a handler. Multiple triggers mean unpredictable execution and duplicated queries.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Query Once, Use A Map:<\/b><span style=\"font-weight: 400;\"> The single most valuable habit in Apex.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Query Only The Fields You Need.<\/b><span style=\"font-weight: 400;\"> Heap and CPU both benefit.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Cache Describe Calls.<\/b><span style=\"font-weight: 400;\"> Expensive and rarely need repeating.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Use Before-Save Flows<\/b><span style=\"font-weight: 400;\">: For same-record updates, they consume no DML at all.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Consolidate Automation:<\/b><span style=\"font-weight: 400;\"> Overlapping Flows and triggers on one object multiply cost.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Run PMD or Apex Code Analyzer in CI:<\/b><span style=\"font-weight: 400;\"> It catches SOQL and DML in loops before review. See <\/span><a href=\"https:\/\/dianapps.com\/blog\/salesforce-devops-guide\/\"><span style=\"font-weight: 400;\">Salesforce DevOps<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Test with 200+ records<\/b><span style=\"font-weight: 400;\">: Because that\u2019s what production sends.<\/span><\/li>\n<\/ul>\n<div style=\"background: #EEF2FE; border: 1px solid #DBE2FB; border-radius: 14px; padding: 28px 32px; margin: 38px 0;\">\n<h4 style=\"color: #1b3fae; font-size: 22px; line-height: 1.3; font-weight: bold; margin: 0 0 10px;\"><span style=\"font-weight: 400;\"><b>Need More Salesforce Engineering Capacity?<\/b><\/span><\/h4>\n<p style=\"color: #4b5563; font-size: 16px; line-height: 1.6; margin: 0 0 22px;\"><span style=\"font-weight: 400;\">Add experienced Salesforce developers to optimize Apex, refactor automation, and keep complex workloads within platform limits.<\/span><\/p>\n<p><a style=\"display: inline-block; background: #2563EB; color: #ffffff; text-decoration: none; font-size: 15px; font-weight: 600; padding: 13px 26px; border-radius: 8px;\" href=\"https:\/\/dianapps.com\/hire-salesforce-developers\">Hire Salesforce Developers \u2192<\/a><\/p>\n<\/div>\n<h2><b>Where to Go Next<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">For the language these limits constrain, see the <\/span><a href=\"https:\/\/dianapps.com\/blog\/apex-programming-guide\/\"><span style=\"font-weight: 400;\">Apex programming guide<\/span><\/a><span style=\"font-weight: 400;\"> &#8211; particularly the bulkification and async sections.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For query efficiency and selectivity, the <\/span><a href=\"https:\/\/dianapps.com\/blog\/salesforce-devops-guide\/\"><span style=\"font-weight: 400;\">SOQL and SOSL guide<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For declarative automation drawing on the same budget, <\/span><a href=\"https:\/\/dianapps.com\/blog\/the-ultimate-guide-to-salesforce-flow\/\"><span style=\"font-weight: 400;\">Salesforce Flow<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">Flow vs Apex<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For catching these issues before they reach production, <\/span><a href=\"https:\/\/dianapps.com\/blog\/salesforce-devops-guide\/\"><span style=\"font-weight: 400;\">Salesforce DevOps<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/dianapps.com\/blog\/salesforce-sandbox-explained\/\"><span style=\"font-weight: 400;\">sandboxes<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The <\/span><a href=\"https:\/\/dianapps.com\/blog\/salesforce-development-guide\/\"><span style=\"font-weight: 400;\">complete Salesforce development guide<\/span><\/a><span style=\"font-weight: 400;\"> is the hub.<\/span><\/p>\n<h2><b>When Limits Become an Architecture Problem<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">One trigger hitting a limit is a bug, while an org where limits are hit routinely is a design problem &#8211; usually too much automation on too few objects, accumulated over years by people who\u2019ve since left.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We\u2019re a certified Salesforce Consulting Partner, and Salesforce Development Services are often part of this remediation work: mapping what fires on save, consolidating overlapping automation, restructuring triggers into a proper framework, and moving what genuinely needs to be async.<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">Or if you need help with a specific limit you can\u2019t get past, <\/span><\/i><a href=\"https:\/\/dianapps.com\/salesforce-development-services\"><i><span style=\"font-weight: 400;\">our Salesforce development team<\/span><\/i><\/a><i><span style=\"font-weight: 400;\"> can pair with your developers.<\/span><\/i><\/p>\n<p>&nbsp;<\/p>\n<style>.elementor-20336 .elementor-element.elementor-element-2932a52{text-align:left;}.elementor-20336 .elementor-element.elementor-element-2932a52 > .elementor-widget-container{margin:0px 0px 0px 0px;}.elementor-20336 .elementor-element.elementor-element-0b767d1 .elementor-tab-title{border-width:1px;border-color:#00000014;}.elementor-20336 .elementor-element.elementor-element-0b767d1 .elementor-tab-content{border-width:1px;border-bottom-color:#00000014;}.elementor-20336 .elementor-element.elementor-element-0b767d1 > .elementor-widget-container{margin:0px 0px 0px 0px;}<\/style><div class=\"porto-block elementor elementor-20336\">\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-27707ca elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"27707ca\" data-element_type=\"section\">\r\n\t\t\t\r\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0163611\" data-id=\"0163611\" data-element_type=\"column\">\r\n\r\n\t\t\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\r\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-03a2969 elementor-widget elementor-widget-text-editor\" data-id=\"03a2969\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.14.0 - 26-06-2023 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2932a52 elementor-widget elementor-widget-heading\" data-id=\"2932a52\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.14.0 - 26-06-2023 *\/\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/style><h2 class=\"elementor-heading-title elementor-size-large\">FAQs <\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0b767d1 elementor-widget elementor-widget-toggle\" data-id=\"0b767d1\" data-element_type=\"widget\" data-widget_type=\"toggle.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.14.0 - 26-06-2023 *\/\n.elementor-toggle{text-align:left}.elementor-toggle .elementor-tab-title{font-weight:700;line-height:1;margin:0;padding:15px;border-bottom:1px solid #d5d8dc;cursor:pointer;outline:none}.elementor-toggle .elementor-tab-title .elementor-toggle-icon{display:inline-block;width:1em}.elementor-toggle .elementor-tab-title .elementor-toggle-icon svg{-webkit-margin-start:-5px;margin-inline-start:-5px;width:1em;height:1em}.elementor-toggle .elementor-tab-title .elementor-toggle-icon.elementor-toggle-icon-right{float:right;text-align:right}.elementor-toggle .elementor-tab-title .elementor-toggle-icon.elementor-toggle-icon-left{float:left;text-align:left}.elementor-toggle .elementor-tab-title .elementor-toggle-icon .elementor-toggle-icon-closed{display:block}.elementor-toggle .elementor-tab-title .elementor-toggle-icon .elementor-toggle-icon-opened{display:none}.elementor-toggle .elementor-tab-title.elementor-active{border-bottom:none}.elementor-toggle .elementor-tab-title.elementor-active .elementor-toggle-icon-closed{display:none}.elementor-toggle .elementor-tab-title.elementor-active .elementor-toggle-icon-opened{display:block}.elementor-toggle .elementor-tab-content{padding:15px;border-bottom:1px solid #d5d8dc;display:none}@media (max-width:767px){.elementor-toggle .elementor-tab-title{padding:12px}.elementor-toggle .elementor-tab-content{padding:12px 10px}}.e-con-inner>.elementor-widget-toggle,.e-con>.elementor-widget-toggle{width:var(--container-widget-width);--flex-grow:var(--container-widget-flex-grow)}<\/style>\t\t<div class=\"elementor-toggle\">\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1201\" class=\"elementor-tab-title\" data-tab=\"1\" role=\"button\" aria-controls=\"elementor-tab-content-1201\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">What are governor limits in Salesforce?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1201\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"1\" role=\"region\" aria-labelledby=\"elementor-tab-title-1201\"><p><span style=\"font-weight: 400;\">Per-transaction resource caps enforced by Salesforce to protect its multi-tenant platform. They cap SOQL queries, DML statements, CPU time, heap size, and more. Exceeding one throws a runtime exception that cannot be caught, and the entire transaction rolls back.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1202\" class=\"elementor-tab-title\" data-tab=\"2\" role=\"button\" aria-controls=\"elementor-tab-content-1202\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">How do I fix \u201cToo many SOQL queries: 101\u201d?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1202\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"2\" role=\"region\" aria-labelledby=\"elementor-tab-title-1202\"><p><span style=\"font-weight: 400;\">Move the query outside the loop, collect the IDs you need into a <\/span><span style=\"font-weight: 400;\">Set<\/span><span style=\"font-weight: 400;\">, run one query into a <\/span><span style=\"font-weight: 400;\">Map<\/span><span style=\"font-weight: 400;\"> outside the loop, then loop again to apply the results. A query inside a loop is the cause in almost every case.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1203\" class=\"elementor-tab-title\" data-tab=\"3\" role=\"button\" aria-controls=\"elementor-tab-content-1203\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">What causes \u201cApex CPU time limit exceeded\u201d?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1203\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"3\" role=\"region\" aria-labelledby=\"elementor-tab-title-1203\"><p><span style=\"font-weight: 400;\">Accumulated processing across the whole transaction, most often nested loops, too much automation on one object, JSON parsing of large structures, or describe calls inside loops. Note that SOQL and DML wait time doesn\u2019t count toward CPU; only your own processing does.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1204\" class=\"elementor-tab-title\" data-tab=\"4\" role=\"button\" aria-controls=\"elementor-tab-content-1204\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">How do I reduce Apex heap size?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1204\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"4\" role=\"region\" aria-labelledby=\"elementor-tab-title-1204\"><p><span style=\"font-weight: 400;\">Select fewer fields, use a SOQL for-loop to process records in chunks of 200, mark Visualforce controller variables <\/span><span style=\"font-weight: 400;\">transient<\/span><span style=\"font-weight: 400;\">, null out large collections when finished, and move genuinely large volumes to Batch Apex.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1205\" class=\"elementor-tab-title\" data-tab=\"5\" role=\"button\" aria-controls=\"elementor-tab-content-1205\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">Do asynchronous limits double everything?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1205\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"5\" role=\"region\" aria-labelledby=\"elementor-tab-title-1205\"><p><span style=\"font-weight: 400;\">No, CPU time goes from 10 to 60 seconds, and heap from 6MB to 12MB, but SOQL query rows stay at 50,000, and DML statements stay at 150. Async solves CPU and heap problems; it doesn\u2019t solve volume problems.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1206\" class=\"elementor-tab-title\" data-tab=\"6\" role=\"button\" aria-controls=\"elementor-tab-content-1206\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">Do Flows count toward Apex governor limits?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1206\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"6\" role=\"region\" aria-labelledby=\"elementor-tab-title-1206\"><p><span style=\"font-weight: 400;\">Yes, everything firing on a save shares one transaction budget &#8211; your Apex, other triggers, record-triggered Flows, validation rules, and managed package logic. A trigger that passes in isolation can fail when a Flow runs alongside it.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1207\" class=\"elementor-tab-title\" data-tab=\"7\" role=\"button\" aria-controls=\"elementor-tab-content-1207\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">How do I check how close to a limit I am?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1207\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"7\" role=\"region\" aria-labelledby=\"elementor-tab-title-1207\"><p><span style=\"font-weight: 400;\">Use the <\/span><span style=\"font-weight: 400;\">Limits<\/span><span style=\"font-weight: 400;\"> class at runtime &#8211; <\/span><span style=\"font-weight: 400;\">Limits.getQueries()<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">getDmlStatements()<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">getCpuTime()<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">getHeapSize()<\/span><span style=\"font-weight: 400;\">, each with a matching <\/span><span style=\"font-weight: 400;\">getLimit&#8230;()<\/span><span style=\"font-weight: 400;\"> method. The Limits section at the bottom of a debug log also shows exactly what the transaction consumed.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1208\" class=\"elementor-tab-title\" data-tab=\"8\" role=\"button\" aria-controls=\"elementor-tab-content-1208\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">Can governor limits be increased?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1208\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"8\" role=\"region\" aria-labelledby=\"elementor-tab-title-1208\"><p><span style=\"font-weight: 400;\">Per-transaction limits are hard and cannot be raised. Some static and platform limits are soft &#8211; Apex code size and API call allowances, for example and Salesforce Support can increase those on request or via add-ons.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<h3 id=\"elementor-tab-title-1209\" class=\"elementor-tab-title\" data-tab=\"9\" role=\"button\" aria-controls=\"elementor-tab-content-1209\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><i class=\"fas fa-caret-right\"><\/i><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><i class=\"elementor-toggle-icon-opened fas fa-caret-up\"><\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">Why does Batch Apex help with governor limits?<\/a>\n\t\t\t\t\t<\/h3>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1209\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"9\" role=\"region\" aria-labelledby=\"elementor-tab-title-1209\"><p><span style=\"font-weight: 400;\">Because limits reset for every chunk of 200 records. A Batch job processing 100,000 records gets a fresh allocation of queries and DML per chunk rather than one allocation for the whole job, which is why it handles up to 50 million records.<\/span><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t<script type=\"application\/ld+json\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"What are governor limits in Salesforce?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Per-transaction resource caps enforced by Salesforce to protect its multi-tenant platform. They cap SOQL queries, DML statements, CPU time, heap size, and more. Exceeding one throws a runtime exception that cannot be caught, and the entire transaction rolls back.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"How do I fix \\u201cToo many SOQL queries: 101\\u201d?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Move the query outside the loop, collect the IDs you need into a <\\\/span><span style=\\\"font-weight: 400;\\\">Set<\\\/span><span style=\\\"font-weight: 400;\\\">, run one query into a <\\\/span><span style=\\\"font-weight: 400;\\\">Map<\\\/span><span style=\\\"font-weight: 400;\\\"> outside the loop, then loop again to apply the results. A query inside a loop is the cause in almost every case.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"What causes \\u201cApex CPU time limit exceeded\\u201d?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Accumulated processing across the whole transaction, most often nested loops, too much automation on one object, JSON parsing of large structures, or describe calls inside loops. Note that SOQL and DML wait time doesn\\u2019t count toward CPU; only your own processing does.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"How do I reduce Apex heap size?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Select fewer fields, use a SOQL for-loop to process records in chunks of 200, mark Visualforce controller variables <\\\/span><span style=\\\"font-weight: 400;\\\">transient<\\\/span><span style=\\\"font-weight: 400;\\\">, null out large collections when finished, and move genuinely large volumes to Batch Apex.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"Do asynchronous limits double everything?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">No, CPU time goes from 10 to 60 seconds, and heap from 6MB to 12MB, but SOQL query rows stay at 50,000, and DML statements stay at 150. Async solves CPU and heap problems; it doesn\\u2019t solve volume problems.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"Do Flows count toward Apex governor limits?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Yes, everything firing on a save shares one transaction budget &#8211; your Apex, other triggers, record-triggered Flows, validation rules, and managed package logic. A trigger that passes in isolation can fail when a Flow runs alongside it.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"How do I check how close to a limit I am?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Use the <\\\/span><span style=\\\"font-weight: 400;\\\">Limits<\\\/span><span style=\\\"font-weight: 400;\\\"> class at runtime &#8211; <\\\/span><span style=\\\"font-weight: 400;\\\">Limits.getQueries()<\\\/span><span style=\\\"font-weight: 400;\\\">, <\\\/span><span style=\\\"font-weight: 400;\\\">getDmlStatements()<\\\/span><span style=\\\"font-weight: 400;\\\">, <\\\/span><span style=\\\"font-weight: 400;\\\">getCpuTime()<\\\/span><span style=\\\"font-weight: 400;\\\">, <\\\/span><span style=\\\"font-weight: 400;\\\">getHeapSize()<\\\/span><span style=\\\"font-weight: 400;\\\">, each with a matching <\\\/span><span style=\\\"font-weight: 400;\\\">getLimit&#8230;()<\\\/span><span style=\\\"font-weight: 400;\\\"> method. The Limits section at the bottom of a debug log also shows exactly what the transaction consumed.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"Can governor limits be increased?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Per-transaction limits are hard and cannot be raised. Some static and platform limits are soft &#8211; Apex code size and API call allowances, for example and Salesforce Support can increase those on request or via add-ons.<\\\/span><\\\/p>\"}},{\"@type\":\"Question\",\"name\":\"Why does Batch Apex help with governor limits?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p><span style=\\\"font-weight: 400;\\\">Because limits reset for every chunk of 200 records. A Batch job processing 100,000 records gets a fresh allocation of queries and DML per chunk rather than one allocation for the whole job, which is why it handles up to 50 million records.<\\\/span><\\\/p>\"}}]}<\/script>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\r\n\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t<\/section>\r\n\t\t<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Governor limits are the reason code that works perfectly in a sandbox falls over in production. The two everyone knows, 100 SOQL queries and 150 DML statements, are the easy ones. They have an obvious cause and a five-minute fix; the ones that cost real time are CPU time exceeded and heap size too large, [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":20346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_meta-robots-noindex":"","_yoast_wpseo_meta-robots-nofollow":"","_yoast_wpseo_canonical":"","_yoast_wpseo_opengraph-title":"","_yoast_wpseo_opengraph-description":"","_yoast_wpseo_opengraph-image":"","_yoast_wpseo_twitter-title":"","_yoast_wpseo_twitter-description":"","_yoast_wpseo_twitter-image":"","_wp_applaud_exclude":false,"footnotes":""},"categories":[85],"tags":[2566],"class_list":["post-20333","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","tag-salesforce-governor-limits"],"featured_image_src":{"landsacpe":["https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83-1140x445.webp",1140,445,true],"list":["https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83-463x348.webp",463,348,true],"medium":["https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83-300x169.webp",300,169,true],"full":["https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83.webp",1536,864,false]},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Salesforce Governor Limits: Full Reference and How to Fix Them<\/title>\n<meta name=\"description\" content=\"Salesforce Governor Limits explained with a complete reference table, common errors, causes, fixes, and Apex optimization strategies for scalable Salesforce development.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Salesforce Governor Limits: Full Reference and How to Fix Them\" \/>\n<meta property=\"og:description\" content=\"Salesforce Governor Limits explained with a complete reference table, common errors, causes, fixes, and Apex optimization strategies for scalable Salesforce development.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn About Digital Transformation &amp; Development | DianApps Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-19T12:25:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-19T12:25:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"864\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Vaibhav Sharma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vaibhav Sharma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Salesforce Governor Limits: Full Reference and How to Fix Them","description":"Salesforce Governor Limits explained with a complete reference table, common errors, causes, fixes, and Apex optimization strategies for scalable Salesforce development.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/","og_locale":"en_US","og_type":"article","og_title":"Salesforce Governor Limits: Full Reference and How to Fix Them","og_description":"Salesforce Governor Limits explained with a complete reference table, common errors, causes, fixes, and Apex optimization strategies for scalable Salesforce development.","og_url":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/","og_site_name":"Learn About Digital Transformation &amp; Development | DianApps Blog","article_published_time":"2026-08-19T12:25:35+00:00","article_modified_time":"2026-08-19T12:25:49+00:00","og_image":[{"width":1536,"height":864,"url":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83.webp","type":"image\/webp"}],"author":"Vaibhav Sharma","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vaibhav Sharma","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#article","isPartOf":{"@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/"},"author":{"name":"Vaibhav Sharma","@id":"https:\/\/dianapps.com\/blog\/#\/schema\/person\/e0ee1e2a6cfb8681a3cc69154f8d8bcf"},"headline":"Salesforce Governor Limits: Full Reference and How to Fix Them","datePublished":"2026-08-19T12:25:35+00:00","dateModified":"2026-08-19T12:25:49+00:00","mainEntityOfPage":{"@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/"},"wordCount":1442,"commentCount":0,"image":{"@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#primaryimage"},"thumbnailUrl":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83.webp","keywords":["Salesforce governor limits"],"articleSection":["Salesforce"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/","url":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/","name":"Salesforce Governor Limits: Full Reference and How to Fix Them","isPartOf":{"@id":"https:\/\/dianapps.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#primaryimage"},"image":{"@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#primaryimage"},"thumbnailUrl":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83.webp","datePublished":"2026-08-19T12:25:35+00:00","dateModified":"2026-08-19T12:25:49+00:00","author":{"@id":"https:\/\/dianapps.com\/blog\/#\/schema\/person\/e0ee1e2a6cfb8681a3cc69154f8d8bcf"},"description":"Salesforce Governor Limits explained with a complete reference table, common errors, causes, fixes, and Apex optimization strategies for scalable Salesforce development.","breadcrumb":{"@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#primaryimage","url":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83.webp","contentUrl":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/08\/Untitled-design-83.webp","width":1536,"height":864,"caption":"Salesforce Governor Limits: Full Reference and How to Fix Them"},{"@type":"BreadcrumbList","@id":"https:\/\/dianapps.com\/blog\/salesforce-governor-limits\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dianapps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Salesforce Governor Limits: Full Reference and How to Fix Them"}]},{"@type":"WebSite","@id":"https:\/\/dianapps.com\/blog\/#website","url":"https:\/\/dianapps.com\/blog\/","name":"Learn About Digital Transformation &amp; Development | DianApps Blog","description":"Dianapps","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dianapps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/dianapps.com\/blog\/#\/schema\/person\/e0ee1e2a6cfb8681a3cc69154f8d8bcf","name":"Vaibhav Sharma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/07\/cropped-Vaibhav-Sharma-Salesforce-Specialist-96x96.jpg","url":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/07\/cropped-Vaibhav-Sharma-Salesforce-Specialist-96x96.jpg","contentUrl":"https:\/\/dianapps.com\/blog\/wp-content\/uploads\/2026\/07\/cropped-Vaibhav-Sharma-Salesforce-Specialist-96x96.jpg","caption":"Vaibhav Sharma"},"description":"A Salesforce specialist with over 15 years in the field, Vaibhav Sharma has built his career at the intersection of CRM strategy and enterprise transformation. As the driving force behind Salesforce innovation at DianApps, he architects solutions across Sales Cloud, Service Cloud, and Experience Cloud that turn fragmented customer data into unified growth engines. His work spans a 360-degree perspective in BFSI, healthcare, and retail, where he's known for engineering platforms that don't just go live, they move revenue and retention numbers. Vaibhav's edge lies in reading where Salesforce is headed next, from AI-powered automation, AgentExchange to Agentforce, and translating that foresight into roadmaps enterprise leaders can act on today.","url":"https:\/\/dianapps.com\/blog\/author\/vaibhav-sharma\/"}]}},"_links":{"self":[{"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/posts\/20333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/comments?post=20333"}],"version-history":[{"count":2,"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/posts\/20333\/revisions"}],"predecessor-version":[{"id":20345,"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/posts\/20333\/revisions\/20345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/media\/20346"}],"wp:attachment":[{"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/media?parent=20333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/categories?post=20333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dianapps.com\/blog\/wp-json\/wp\/v2\/tags?post=20333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}