Repository navigation
Use correlated EXISTS for PostgreSQL session activity data - #4528
Merged
mikecao merged 1 commit intoSep 11, 2026
Merged
Conversation
|
@dongwonmoon is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryThis PR optimizes PostgreSQL session activity queries by replacing a website/date-wide
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified. The changed predicate preserves the prior filtering semantics while correlating through a non-null indexed foreign key, and no concrete regression remains.
|
| Filename | Overview |
|---|---|
| src/queries/sql/sessions/getSessionActivity.ts | Rewrites the PostgreSQL hasData predicate as a semantically equivalent correlated lookup that can use the existing event ID index. |
Reviews (1): Last reviewed commit: "Use correlated EXISTS for PostgreSQL ses..." | Re-trigger Greptile
mikecao
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement the correlated
EXISTSproposed in #4526 for PostgreSQL session activity queries.The existing
hasDataexpression checks event IDs against site/date-wideevent_data. Depending on the data and query plan, opening a session profile can repeatedly scan a large materialized result. The correlated check lets PostgreSQL look up properties for each event using the existingwebsite_event_idindex.Website/date predicates, returned fields, ordering, and the 500-row limit are unchanged. No new index or configuration is required. The ClickHouse implementation is unchanged.
Verification
SKIP_DB_CHECK=1(database checks/migrations skipped).devrevision produce identical diagnostics (6 errors, 13 warnings, 11 infos).These are SQL-level checks using temporary tables, not a production or API performance benchmark. The diagnosis and proposed approach come from #4526; this change implements that approach with independent verification.
Source-derived SQL check · Measurement summary and limitations
Related: #4526
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.