MetaLens360Help Center

Measure query amplification in trigger chains

See how many SOQL queries each transaction issues compared with the data it actually needs, find the worst trigger chains and objects, and save snapshots to track progress.

Updated in Code & performance analysis

Overview

Query Amplification Intelligence measures how much extra querying your automation does. For each transaction it calculates an amplification factor:

A factor of 1 means every query fetches something new. A factor of 4 means the transaction runs four queries for every distinct piece of data it needs — usually because several triggers, handlers or Flows each fetch the same records. High amplification is a leading cause of "Too many SOQL queries: 101" errors under bulk loads.

Before you start

  • The org must be synced and indexed. Use Index Org in Apex Flow Analyzer or Index in Sync Center, or the indexing buttons on this page.
  • Saving a snapshot needs the snapshots.manage permission.

Steps

  1. Open Query Amplification under Code & Performance Analysis.
  2. Pick the org.
  3. Click Analyze Amplification. If a recent result exists, you see "Results from cache · analyzed …" — click Refresh to recalculate.
  4. On Process View, review the transactions ranked by amplification. The top 10 are shown.
  5. Switch to Object Intelligence to see which objects are queried redundantly across processes.
  6. After a sync that brought in code changes, click Re-Index so the analysis reflects the new code.
  7. Click Save Snapshot, enter a Snapshot label (for example "Before Sprint 45 refactor") and save.
  8. Later, click Compare Snapshots (N) to compare saved snapshots side by side.

Example

Priya, a release manager, analyzes acme-uat and sees the Case insert chain with an amplification factor of 5.2: 26 queries for 5 distinct data needs. Object Intelligence shows Account queried from four places in that chain. She saves a snapshot labelled "Before ACME-142 selector refactor". After the developers introduce a shared Account selector and the org is re-synced, she clicks Re-Index, analyzes again and uses Compare Snapshots to show the factor dropped to 1.8.

FAQs

Is a high amplification factor always a bug?

Not always. Some duplication is harmless at low volume. It matters most for objects that are loaded in bulk (data loads, integrations, batch jobs), where each extra query is multiplied across the transaction.

Why only the top 10 transactions?

The page focuses on what to fix first. Use SOQL Risk Intelligence for the full query inventory.

Who can see snapshots?

Everyone in the workspace who can open the page can compare snapshots. Saving and deleting them needs snapshots.manage.

Troubleshooting

"This org has not been indexed yet"

Click Index This Org Now, wait for indexing to finish, then click Analyze Amplification.

"No trigger chains with SOQL found for this org"

Either the org genuinely has no trigger chains that query, or the index is out of date. Click Re-Index & Analyze to rebuild and try again.

My code change is not reflected

The analysis reads the last sync and index. Sync the org, then click Re-Index.

Was this article helpful?

Related articles