Xray
1h 6h 24h 48h 3d 5d 7d 14d 30d ‹
Last 1 hour▾
Ends now. Anything up to this cluster's 30-day retention.
Start and end times
Cancel
Interpreted in UTC (change it at the right of this bar). Earliest available: 2026-10-19 22:51:12.
› →|
updated 1d ago
Sample data. This database was generated by scripts/seed_dev_db.py — every service, deploy, person and figure on this page is synthetic. Names are sample.*@seed.invalid and image tags are prefixed SEED-. Nothing here happened.
← query trends

Query shape trend

plan 5264C101 · last 1h

Optimizer suggestions — proposals from claude-opus-5-5, 3d ago; suggests only, a human applies

index Index the anchor lookup User.email
The issueThe whole query starts from `match(:User{email:$staffEmail})`. `email` is not in the list of indexed/touched properties (only tildaid and type are). If User.email has no index, the planner has to scan every User node and filter on email, and that cost is paid before any expansion. One heavy scan like this could explain the gap between a 47 ms average and a 395 ms p95.
The fixAdd a lookup on User.email so the query starts with a NodeIndexSeek. If emails are unique per user, use a uniqueness constraint instead (CREATE CONSTRAINT user_email_unique IF NOT EXISTS FOR (u:User) REQUIRE u.email IS UNIQUE). That gives the same seek and also guarantees data integrity. Run SHOW INDEXES first, because an index may already exist under another name.
Add this index
CREATE INDEX user_email IF NOT EXISTS FOR (u:User) ON (u.email)
Expected: If no index exists today, the starting step should go from a full scan of all User nodes to a single seek. That probably cuts several to tens of ms per call, more on the slow p95 calls. The total saving is small because the query ran only 7 times in 7 days. · Evidence: Run SHOW INDEXES WHERE labelsOrTypes = ['User'] to see whether an index exists. Compare PROFILE before and after: the first operator should change from NodeByLabelScan + Filter to NodeIndexSeek (or NodeUniqueIndexSeek), and db hits for that operator should drop.
index Index Organization.alias used in the Site/SMO optional match
The issue`optional match (v)-[]-(s:Site)-[:SITE_TO_SMO]->(smo:Smo)-[:IS_AN_ORG]->(o:Organization{alias:$orgAlias})` filters on Organization.alias, which is not listed as indexed. This optional match runs once per VisitAppointment row, after those rows have already been multiplied by every matching Phi. With no index, the planner can only expand from v through an untyped `-[]-` relationship and check alias at the end. It cannot start from the single matching Organization and join back.
The fixCreate an index on Organization.alias. The planner can then seek the one Organization, expand o<-IS_AN_ORG-smo<-SITE_TO_SMO-s, and value-hash-join on s instead of expanding every relationship of every v. This works best if alias is selective; if it's unique, a uniqueness constraint is better.
Add this index
CREATE INDEX organization_alias IF NOT EXISTS FOR (o:Organization) ON (o.alias)
Expected: Probably a moderate reduction in db hits for the optional-match branch on calls that return many visits. The effect will be small on calls that return only a few visits. · Evidence: Look at PROFILE output for the OptionalExpand/Filter on Organization.alias before the change, and check whether a NodeIndexSeek on Organization(alias) plus a join appears afterwards. Compare db hits and p95 over the next week.

Status: proposed · all suggestions

No rollups for this shape in the window.