-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Speed up filtering persons (#25604)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Tomás Farías Santana <[email protected]> Co-authored-by: Marius Andra <[email protected]> Co-authored-by: Georgiy Tarasov <[email protected]> Co-authored-by: David Newell <[email protected]> Co-authored-by: PostHog Bot <[email protected]> Co-authored-by: Richard Borcsik <[email protected]> Co-authored-by: Michael Matloka <[email protected]> Co-authored-by: Eric Duong <[email protected]> Co-authored-by: Paul D'Ambra <[email protected]> Co-authored-by: Juraj Majerik <[email protected]> Co-authored-by: Phani Raj <[email protected]> Co-authored-by: Tom Owers <[email protected]> Co-authored-by: Dylan Martin <[email protected]> Co-authored-by: Oliver Browne <[email protected]> Co-authored-by: Marcus Hof <[email protected]> Co-authored-by: Michael Matloka <[email protected]> Co-authored-by: Anirudh Pillai <[email protected]> Co-authored-by: Sandy Spicer <[email protected]> Co-authored-by: Neil Kakkar <[email protected]>
- Loading branch information
1 parent
f31abb5
commit 3f75806
Showing
45 changed files
with
3,339 additions
and
3,015 deletions.
There are no files selected for viewing
96 changes: 60 additions & 36 deletions
96
...ssion_recordings/queries/test/__snapshots__/test_session_recording_list_from_filters.ambr
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
+46 Bytes
(100%)
frontend/__snapshots__/exporter-exporter--trends-line-insight-detailed--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+41 Bytes
(100%)
frontend/__snapshots__/exporter-exporter--trends-line-insight-detailed--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -442,14 +442,17 @@ | |
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) | ||
LEFT JOIN | ||
(SELECT person.id AS id, | ||
replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email | ||
argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', ''), person.version) AS properties___email | ||
FROM person | ||
WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), | ||
(SELECT person.id AS id, max(person.version) AS version | ||
FROM person | ||
WHERE equals(person.team_id, 2) | ||
GROUP BY person.id | ||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0)))), 0)) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id) | ||
WHERE and(equals(person.team_id, 2), in(person.id, | ||
(SELECT person.id AS id | ||
FROM person | ||
WHERE and(equals(person.team_id, 2), notIn(person.id, | ||
(SELECT person.id AS id | ||
FROM person | ||
WHERE and(equals(person.team_id, 2), equals(person.is_deleted, 1)))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0)))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0)) | ||
GROUP BY person.id | ||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0)) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id) | ||
WHERE and(equals(events.team_id, 2), ifNull(equals(events__person.properties___email, '[email protected]'), 0), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-10 12:14:05.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-09 12:14:00.000000', 6, 'UTC'))) | ||
ORDER BY events.event ASC | ||
LIMIT 101 | ||
|
@@ -480,14 +483,17 @@ | |
HAVING ifNull(equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) | ||
LEFT JOIN | ||
(SELECT person.id AS id, | ||
nullIf(nullIf(person.pmat_email, ''), 'null') AS properties___email | ||
argMax(nullIf(nullIf(person.pmat_email, ''), 'null'), person.version) AS properties___email | ||
FROM person | ||
WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), | ||
(SELECT person.id AS id, max(person.version) AS version | ||
FROM person | ||
WHERE equals(person.team_id, 2) | ||
GROUP BY person.id | ||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0)))), 0)) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id) | ||
WHERE and(equals(person.team_id, 2), in(person.id, | ||
(SELECT person.id AS id | ||
FROM person | ||
WHERE and(equals(person.team_id, 2), notIn(person.id, | ||
(SELECT person.id AS id | ||
FROM person | ||
WHERE and(equals(person.team_id, 2), equals(person.is_deleted, 1)))), ifNull(equals(nullIf(nullIf(person.pmat_email, ''), 'null'), '[email protected]'), 0)))), ifNull(equals(nullIf(nullIf(person.pmat_email, ''), 'null'), '[email protected]'), 0)) | ||
GROUP BY person.id | ||
HAVING and(ifNull(equals(argMax(person.is_deleted, person.version), 0), 0), ifNull(less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))), 0)) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id) | ||
WHERE and(equals(events.team_id, 2), ifNull(equals(events__person.properties___email, '[email protected]'), 0), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-10 12:14:05.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-09 12:14:00.000000', 6, 'UTC'))) | ||
ORDER BY events.event ASC | ||
LIMIT 101 | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.