Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Add default time filter to ClickHouse queries to avoid full tabl... #1041

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

Open
m0nikasingh wants to merge 2 commits into hyperdxio:main
base: main
Choose a base branch
Loading
from m0nikasingh:main

Conversation

@m0nikasingh
Copy link

@m0nikasingh m0nikasingh commented Jul 30, 2025

...e scans

fixes: #1036

Copy link

changeset-bot bot commented Jul 30, 2025
edited
Loading

⚠️ No Changeset found

Latest commit: b79fec3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jul 30, 2025

@m0nikasingh is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

const where = metricName
? chSql`WHERE MetricName=${{ String: metricName }}`
: '';
: chSql`WHERE TimestampTime > (now() - toIntervalDay(7))`;
Copy link
Contributor

@knudtty knudtty Aug 7, 2025

Choose a reason for hiding this comment

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

On line 274, we already use the max_rows_to_read setting to avoid full table scans, I'm not sure changing the time to look here would help

Copy link
Author

@m0nikasingh m0nikasingh Aug 12, 2025

Choose a reason for hiding this comment

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

I see that max_rows_to_read helps limit the amount of data scanned, but the challenge I’m running into is that I can’t use the force_index_by_date setting with HyperDX, because it doesn't filter by the date column. This setting is generally a good practice, as it helps prevent expensive full table scans on large ClickHouse clusters.

I agree that hardcoding a 7-day lookback isn’t the best approach. Ideally, the query should probably use the lookback period from the UI instead. Do you think that could work?

Copy link
Contributor

@MikeShi42 MikeShi42 Aug 13, 2025

Choose a reason for hiding this comment

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

@m0nikasingh I think in general hyperdx shouldn't require force_index_by_date to be set for the user, as all meaningfully queries submitted by the app will use time filters or for queries like this, have reasonable limits applied to terminate early (otherwise it's a bug).

We can revisit how metadata is populated by time range in a more comprehensive PR, but I think for now I'd recommend disabling the restriction for the user that's being used by HyperDX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@MikeShi42 MikeShi42 MikeShi42 left review comments

@knudtty knudtty knudtty left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Full table scan in ClickHouse due to HyperDX query missing date filter

AltStyle によって変換されたページ (->オリジナル) /