---
title: "Discussion on \"SOQL Selectivity: Avoiding Full Table Scans on Million-Row Objects\" | Hashnode"
description: "Discussion on \"SOQL Selectivity: Avoiding Full Table Scans on Million-Row Objects\". A query that runs in 200ms against 100K records can run for 30 seconds against 5M records. The difference is selectivity. The fix is index design, query shape, and a few patterns that keep Apex fast as the org grows."
url: "https://hashnode.com/posts/soql-selectivity-avoiding-full-table-scans-on-million-row-objects/6a127b11fd145682d6cda862"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [SOQL Selectivity: Avoiding Full Table Scans on Million-Row Objects](https://sapotacorpvn.hashnode.dev/soql-selectivity-avoiding-full-table-scans-on-million-row-objects?utm_source=hashnode&utm_medium=feed)

A query that runs in 200ms against 100K records can run for 30 seconds against 5M records. The difference is selectivity. The fix is index design, query shape, and a few patterns that keep Apex fast as the org grows.

May 24 · 7 min read · sapotacorpvn.hashnode.dev  
Read the article

-   [#salesforce](https://hashnode.com/tag/salesforce)
-   [#apex](https://hashnode.com/tag/apex)
-   [#soql](https://hashnode.com/tag/soql)
-   [#apex-development](https://hashnode.com/tag/apex-development)
-   [#performance](https://hashnode.com/tag/performance)

## Written by

[SapotaCorp](https://hashnode.com/@sapotacorpvn)

@sapotacorpvn · Hanoi, Vietnam

  
[View profile](https://hashnode.com/@sapotacorpvn)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
