Skip to content

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.

SearchObserved planExecution time
First page, no queryOrganization index scan on patient_profiles_list_idx; 21 rows0.035 ms
Selective rare-needle substringGIN bitmap scan on patient_profiles_search_idx, organization filter, then sort; 20 rows2.313 ms
Common one-character aOrganization listing index with literal substring filter; 21 rows0.041 ms
Absent one-character zOrganization-filtered scan; no matching rows8.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.

Documentation follows the source. Planned contracts are marked explicitly.