Skip to content

Limit time range when querying labels and label values #5695

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
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

secfree
Copy link
Contributor

@secfree secfree commented Jun 15, 2025

Currently parca scans the whole table when querying "labels" and "values" of a label. Even "start" and "end" have already been defined and reserved in the definition, they are not transmitted. This PR add time range limitation to these queries and avoid the whole table scanning.

Below is the "Explain" of the "QueryBuilder"

TableScan [concurrent] - PredicateFilter ((name == parca_agent AND (sample_type == samples AND (sample_unit == count AND (period_type == cpu AND (period_unit == nanoseconds AND duration != 0)))))) - Projection (labels) - Synchronizer

TableScan [concurrent] - PredicateFilter ((name == parca_agent AND (sample_type == samples AND (sample_unit == count AND (period_type == cpu AND (period_unit == nanoseconds AND duration != 0)))))) - Projection (labels.comm) - Distinction (labels.comm) - Synchronizer - Distinction (labels.comm)

After applying this PR, they have "(timestamp > xxx AND timestamp < yyy)"

TableScan [concurrent] - PredicateFilter ((name == parca_agent AND (sample_type == samples AND (sample_unit == count AND (period_type == cpu AND (period_unit == nanoseconds AND (duration != 0 AND (timestamp > 1749980021601 AND timestamp < 1749983621601)))))))) - Projection (labels) - Synchronizer

TableScan [concurrent] - PredicateFilter ((name == parca_agent AND (sample_type == samples AND (sample_unit == count AND (period_type == cpu AND (period_unit == nanoseconds AND (duration != 0 AND (timestamp > 1749980021601 AND timestamp < 1749983621601)))))))) - Projection (labels.comm) - Distinction (labels.comm) - Synchronizer - Distinction (labels.comm)

@secfree secfree requested a review from a team as a code owner June 15, 2025 10:48
@secfree
Copy link
Contributor Author

secfree commented Jun 23, 2025

@brancz could you take a look at this one? Thank you.

@brancz
Copy link
Member

brancz commented Jun 23, 2025

@manojVivek @yomete can you review this?

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