perf: add explicit start-date bound to funnel steps - #4536
dongwonmoon wants to merge 2 commits into
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. |
Greptile SummaryThis PR adds an explicit report-start predicate to every PostgreSQL funnel step after the first, allowing PostgreSQL to apply its date index without changing the intended event ordering.
Confidence Score: 4/5The implementation appears safe to merge, with a non-blocking opportunity to make the new regression test accurately enforce per-step predicate placement. The SQL change preserves the existing funnel time semantics, but the test can pass when predicates are duplicated in one level and omitted from another because it validates only the aggregate count. Files Needing Attention: src/queries/sql/funnels/getFunnel.test.ts
|
| Filename | Overview |
|---|---|
| src/queries/sql/funnels/getFunnel.ts | Adds a logically consistent explicit start-date predicate to each subsequent PostgreSQL funnel CTE. |
| src/queries/sql/funnels/getFunnel.test.ts | Adds regression coverage for predicate emission, but the aggregate match count does not verify one predicate per level CTE. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A["Level 1 events<br/>startDate ≤ created_at ≤ endDate"] --> B["Level 2 events<br/>previous time ≤ created_at ≤ window end<br/>startDate ≤ created_at ≤ endDate"]
B --> C["Subsequent levels<br/>repeat explicit report bounds"]
C --> D["UNION per-level counts"]
Reviews (1): Last reviewed commit: "perf: add explicit start-date bound to f..." | Re-trigger Greptile
Summary
Add an explicit
startDatelower bound to subsequent PostgreSQL funnel steps.The bound is already implied by the preceding step's timestamp, so it does not change the intended matching criteria. Making it explicit allowed PostgreSQL to use the existing date index instead of scanning older events in the tested dataset.
Verification
On a fixed synthetic dataset of approximately 262k events spanning six months (PostgreSQL 15):
These repeated API measurements were taken on v3.3.1. A limited SQL recheck against current
devconfirmed matching results and the short-range index-scan change for the same no-filter queries. Nine focused tests passed using cached dependencies. Full application build and full-suite tests were not rerun for this submission.The benefit depends on the dataset and query range. No indexes or configuration changes are required; ClickHouse is unchanged.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.