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
suresh p 149suresh p 149 

How to reduce the no of SOQL in a transaction?

SwethaSwetha (Salesforce Developers) 
HI Suresh,
Are you facing any error like "Too many SOQL 101"?

>You need to avoid SOQL queries that are inside FOR loops.
See https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_loops_for_SOQL.htm for examples.
 
>Try loading most of the data into collections (Set, List and Map), creating formulas and rollup-summaries for reducing the number of overall SOQL number of calls.

>Follow the best practices for Triggers and Bulk requests

Also, see the example of  https://salesforce.stackexchange.com/questions/96610/reduce-soql-queries

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you