Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_sql-query-plans-and-indexing

SQL query plans and indexing decisions

7 COMPONENTS · 6 FLOWS · UPDATED 2026-11-23
GITHUB README / PR PREVIEW CARD
[![SQL query plans and indexing decisions — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_sql-query-plans-and-indexing/opengraph-image)](https://archos.sageideas.dev/d/dgm_sql-query-plans-and-indexing)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_sql-query-plans-and-indexing)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_sql-query-plans-and-indexing" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="SQL query plans and indexing decisions — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0[("Client application")]
  parser_1["Connection pooler"]
  planner_2[("PostgreSQL")]
  btree_3[("Block volume")]
  heap_4[("Local NVMe")]
  xray_5[("Continuous profiling")]
  sink_6[("Client application")]
  client_0 -->|"1. Sends SQL · SQL"| parser_1
  parser_1 -->|"2. Plans SQL · SQL"| planner_2
  planner_2 -->|"3a. Index scan · TCP"| btree_3
  planner_2 -->|"3b. Heap fetch · TCP"| heap_4
  heap_4 -->|"4. Buffers · SQL"| xray_5
  xray_5 -->|"5. 7ms rows · SQL"| sink_6

COMPONENT STACK (7)

  • Client applicationSTATEFUL
    10M-row tenant query
  • Connection poolerSTATELESS
    PgBouncer TX route
  • PostgreSQLSTATEFUL
    Cost planner + stats
  • Block volumeSTATEFUL
    Composite B-Tree (EQ->R)
  • Local NVMeSTATEFUL
    Shared buffers / heap
  • Continuous profilingSTATEFUL
    pg_stat_statements
  • Client applicationSTATEFUL
    3.8s -> <7ms p99

REQUEST & DATA FLOW (6)

  1. Client application → Connection pooler (Sends SQL)[SQL]
  2. Connection pooler → PostgreSQL (Plans SQL)[SQL]
  3. PostgreSQL → Block volume (Index scan)[TCP]
  4. PostgreSQL → Local NVMe (Heap fetch)[TCP]
  5. Local NVMe → Continuous profiling (Buffers)[SQL]
  6. Continuous profiling → Client application (<7ms rows)[SQL]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →