// septim forge tools · db / sql

pgvector Query Builder

client-side · zero network calls · no telemetry · no login

// build query

// presets
Fill in the fields above and click "Build query" to generate SQL.
// which distance metric to pick

Three operators. Three use cases.

Every pgvector distance metric maps to a different mathematical notion of similarity. Picking the wrong one silently returns valid-looking but semantically wrong results.

MetricOperatorBest forAvoid when
Cosine distance<=>Normalized embeddings (OpenAI, Cohere, most sentence-transformers). The default for RAG. Measures angle, ignores magnitude.Embeddings are not normalized to unit length.
L2 distance<->Raw un-normalized vectors where magnitude carries meaning. Some image embeddings trained on L2.Typical text embeddings — cosine is almost always better.
Inner product<#>Models explicitly trained with dot-product similarity. Note: pgvector sorts ASC — invert sign for max similarity.Generic embedding models without a known training objective.

Quick rule: OpenAI text-embedding-3-*, Cohere Embed, or any standard sentence-transformers model — use cosine (<=>).

// index selection

HNSW vs IVFFlat

pgvector ships two approximate nearest-neighbor index types with different operational tradeoffs.

FactorHNSWIVFFlat
Build timeSlower (builds the graph)Faster (builds the inverted file)
Query speedFaster at query timeSlower, especially at high recall
MemoryHigher — stores graph edgesLower baseline
RecallHigher out of the boxRequires tuning lists and probes
Incremental insertsHandles wellDegrades; rebuild periodically
Recommended forMost production RAG applicationsConstrained memory, large static datasets

Start with HNSW, m=16, ef_construction=64. Tune ef_search at query time for recall. Set SET hnsw.ef_search = 100; in the session before querying.

// verify zero network calls

How to confirm this tool never phones home

// devtools network tab

Open DevTools (F12 or Cmd+Option+I), click the Network tab, then use the query builder above. After the page finishes loading its fonts and CSS, build a query and watch the Network tab. Zero new requests fire. All computation runs in the browser JavaScript engine — no data leaves your machine.

// building a production AI application on postgres?

Septim Drills includes 25 Claude Code production skills covering SQL migrations, query optimization, and pgvector integration patterns. Drop into ~/.claude/skills/, reference by name, ship faster.

Septim Drills — $29 once →