Skip to content

Commit

Permalink
fix: turns out prewhere and where filtering for the same property is …
Browse files Browse the repository at this point in the history
…no bueno (#19472)

* fix: turns out prewhere and where filtering for the same property is no bueno

* only not like an idiot
  • Loading branch information
pauldambra authored Dec 21, 2023
1 parent 1a34205 commit ac16fa6
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ def __init__(
SELECT distinct log_source_id as session_id
FROM log_entries
PREWHERE team_id = %(team_id)s
-- regardless of what other filters are applied
-- limit by storage TTL
AND timestamp >= %(clamped_to_storage_ttl)s
-- make sure we don't get the occasional unexpected future event
AND timestamp <= now()
-- and then any time filter for the events query
{events_timestamp_clause}
WHERE 1=1
{console_log_clause}
Expand Down Expand Up @@ -274,10 +278,12 @@ def ttl_days(self):
-- regardless of what other filters are applied
-- limit by storage TTL
AND e.timestamp >= %(clamped_to_storage_ttl)s
-- make sure we don't get the occasional unexpected future event
AND e.timestamp <= now()
-- and then any time filter for the events query
{events_timestamp_clause}
WHERE
notEmpty(`$session_id`)
{events_timestamp_clause}
{event_filter_where_conditions}
{prop_filter_clause}
{provided_session_ids_clause}
Expand Down
Loading

0 comments on commit ac16fa6

Please sign in to comment.