Patient search measurement
Measured on 2026-10-25 using the isolated PostgreSQL 16 test container and EXPLAIN (ANALYZE, BUFFERS). The fixture contains 20,000 synthetic profiles in each of two organizations, with current statistics after ANALYZE. Every measured query includes organization and creator-access predicates, orders by creation timestamp/UUID descending, and fetches 21 rows.
| Search | Observed plan | Execution time |
|---|---|---|
| First page, no query | Organization index scan on patient_profiles_list_idx; 21 rows | 0.035 ms |
Selective rare-needle substring | GIN bitmap scan on patient_profiles_search_idx, organization filter, then sort; 20 rows | 2.313 ms |
Common one-character a | Organization listing index with literal substring filter; 21 rows | 0.041 ms |
Absent one-character z | Organization-filtered scan; no matching rows | 8.214 ms |
These local synthetic measurements demonstrate index use and organization filtering; they do not establish production capacity or latency guarantees. The repository caps search execution context at three seconds. Repeat the measurement against representative deployed distributions and concurrent load before changing that limit or scaling the rollout. Short or absent patterns may scan many organization rows even with trigram support.
TestPatientSearchQueryPlanIntegration logs complete query plans, including buffer counts, without sensitive patient data. Run it through make test:e2e with the dedicated local AUTH_TEST_DATABASE_URL configured. Functional integration tests independently verify cross-organization isolation, literal wildcard handling and access filtering before pagination.