Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

pauldambra
Copy link
Member

so, moves all of the timestamp filtering into the prewhere for the session events query (interestingly the log_entries query already did this)

@fuziontech figured this out during an incident

image

Comment on lines +281 to 287
-- 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}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shifted the timestamp clause up into the prewhere here

Comment on lines 88 to 93
-- 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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied the comments up here to make the duplication more obvious so it'll annoy me and I can extract it next time I'm changing this file

Copy link
Contributor

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

@pauldambra pauldambra requested review from fuziontech and a team December 21, 2023 10:04
@pauldambra pauldambra merged commit ac16fa6 into master Dec 21, 2023
71 checks passed
@pauldambra pauldambra deleted the fix/pre-where-and-where-no-bueno branch December 21, 2023 10:35
fuziontech pushed a commit that referenced this pull request Jan 4, 2024
…no bueno (#19472)

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

* only not like an idiot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants