Skip to content

Conversation

@evenyag
Copy link
Contributor

@evenyag evenyag commented Nov 13, 2025

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

#6078

What's changed and what's your intention?

In flat format, split batches before merge if the series number is less than NUM_SERIES_THRESHOLD or each batch after splitting still has BATCH_SIZE_THRESHOLD rows. This may improve the merge performance.

  • It reduces the number of comparison in the heap
  • It avoids interleaving multiple batches which is usually slower than slicing. Although the returned batch may be smaller, the total cost is still lower than before.

We may need to further adjust the two threshold after testing on real workloads.

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

@github-actions github-actions bot added size/S docs-not-required This change does not impact docs. labels Nov 13, 2025
@evenyag evenyag changed the title feat: split batches before merge if the splitted batches won't be too small feat: split batches before merge Nov 13, 2025
@evenyag evenyag marked this pull request as ready for review November 14, 2025 08:17
It checks the num_series and splits batches when the series cardinality
is low

Signed-off-by: evenyag <[email protected]>
Signed-off-by: evenyag <[email protected]>
@evenyag evenyag force-pushed the feat/flat-split-batch branch from da229c7 to b28659c Compare November 18, 2025 06:57
@evenyag evenyag requested a review from fengjiachun November 18, 2025 07:01
@evenyag evenyag added this pull request to the merge queue Nov 18, 2025
Merged via the queue into main with commit ee35ec0 Nov 18, 2025
45 checks passed
@evenyag evenyag deleted the feat/flat-split-batch branch November 18, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants