Skip to content

feat: optimize clickhouse queries by splitting into smaller chunks for caching#1761

Draft
natebwangsut wants to merge 1 commit intografana:mainfrom
natebwangsut:feat/chunk-spliting
Draft

feat: optimize clickhouse queries by splitting into smaller chunks for caching#1761
natebwangsut wants to merge 1 commit intografana:mainfrom
natebwangsut:feat/chunk-spliting

Conversation

@natebwangsut
Copy link
Copy Markdown

Allowing clickhouse to cache queries that matches the previous queried timeframes.

Type of Change

Please check the relevant option.

  • 🚀 Feature
  • 🐛 Bug Fix
  • 📝 Documentation
  • 🧹 Refactor / Chore

Feature

What is this feature?

Aligned time-range chunking for builder time series

  • Splits builder time-series panel requests into aligned sub-ranges using stable chunk sizes.
  • Executes chunked requests under chunk-specific request IDs and merges the results back under the original refId.
  • Deduplicates exact overlapping boundary rows so aligned windows preserve coverage without repeating points.
  • Uses deterministic frame grouping and merge behavior so chunked responses remain stable across repeated requests.

Why is this feature needed?

These changes improve ClickHouse cache reuse in both schema-heavy Grafana flows and repeated builder time-series panel queries while keeping the merge path predictable at chunk boundaries.

Who is this feature for?

Dashboard usage at scale

How to test this feature

Provide step-by-step instructions for reviewers to test the feature.

  1. Running Unit tests
  2. From running infrastructure and setup Grafana to query clickhouse. See whether Grafana plugin splits the queries into smaller chunks. Then slightly move the timeframes and ensure cache works on clickhouse.

Screenshots / Videos

Please provide screenshots or videos demonstrating the bug or the feature working. This helps reviewers understand the change visually and speeds up the review process.

Before After
TBD TBD

Please check that:

  • Tests for this change have been added/updated.
  • Documentation has been added/updated (where applicable).

Special notes for your reviewer

TBD

Allowing clickhouse to cache queries that matches the previous queried
timeframes.
@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Apr 5, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@natebwangsut natebwangsut changed the title feat: optimize queries by chunk-splitting queries into smaller parts for caching feat: optimize clickhouse queries by splitting into smaller chunks for caching Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Incoming

Development

Successfully merging this pull request may close these issues.

1 participant