MetaLens360Help Center

Find SOQL 101 risks with SOQL Risk Intelligence

Detect SOQL anti-patterns, duplicate queries and transaction-level query counts that risk the 100-query governor limit, and get AI remediation advice.

Updated in Code & performance analysis

Overview

SOQL Risk Intelligence helps you find the code that pushes transactions toward the Salesforce limit of 100 SOQL queries — the "SOQL 101" error. The page covers anti-pattern detection, transaction estimation and AI remediation in one place.

The old Governor Risk link (/governor-risk) now opens this page.

Before you start

  • The org must be synced and then indexed. Index it from Apex Flow Analyzer (Index Org) or from Sync Center, or use Index Org for SOQL on this page.
  • AI Risk Insights needs an AI provider configured in Settings → AI Providers.

Steps

  1. Open SOQL Risk Intelligence under Code & Performance Analysis.
  2. Pick the org.
  3. Leave the Test Classes toggle off unless you want test code included. Tests are excluded by default.
  4. Read the Overview tab for the headline risk picture.
  5. Open Anti-Patterns to see queries in loops and similar risky constructs.
  6. Open Duplicate Queries to see the same query issued more than once in a transaction. Click Export Word Report to share it.
  7. Open Data Access Intelligence for Object Analysis, Component Patterns, Within-Class Cache (with ⚡ AI Analyze) and the Access Heat Map.
  8. Use SOQL Inventory to browse every query found, and Transaction Analyzer to estimate query counts per transaction.
  9. On AI Risk Insights, click Run AI Analysis. It takes about 30–60 seconds and the result is saved.
  10. After code changes and a re-sync, click Refresh analysis.

Example

Priya, a release manager, opens acme-prod before a data migration. Transaction Analyzer shows that an Opportunity update path issues an estimated 70 queries for a single record. Duplicate Queries shows the same Account lookup issued from three different classes in that path. She exports the Word report and creates ticket ACME-142 to add a shared selector that caches the Account lookup.

FAQs

Why are test classes excluded by default?

Test classes set up their own data and never run against a production batch, so including them inflates the numbers. Turn on Test Classes when you want to review test code specifically.

Is this the same as Code Analyzer?

No. Code Analyzer runs a tunable rule catalog across Apex, triggers and Flows. SOQL Risk Intelligence focuses on query volume, duplication and data access patterns across a transaction.

Does Run AI Analysis send my code to an AI provider?

It uses the AI providers configured for your workspace. See Who pays for AI generation for details.

Troubleshooting

"No SOQL Data Found"

The org has not been indexed. The page tells you to go to Apex Flow Analyzer, select your org, and click Index Org. You can also click Index Org for SOQL here.

"Failed to load governor data. Index the org first."

Indexing has not completed for this org, or it failed. Run an index, wait for it to finish, then click Refresh analysis.

AI analysis does nothing or fails

Check that an AI provider is configured in Settings → AI Providers. See Fix "AI provider not configured".

Was this article helpful?

Related articles