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

Performance improvements for UNION #15497

Closed
wants to merge 9 commits into from

Conversation

systay
Copy link
Collaborator

@systay systay commented Mar 15, 2024

Description

This PR introduces a new engine primitive - simple-concatenate, that should be used when we have full type information. In these situations we can do the type aggregation at plan time and plan the coercion of columns when needed, instead of having to do this at runtime. If we do it at runtime, we have to block until all sources have returned at least one chunk of data, and that is slow.

I also changed the concatenate primitive to only do the type calculation once per plan, instead of every time it runs. The first time we use a slow sequential execution, but we store the type info so that future uses of the plan can happen fast.

Our goal is to streamline the concatenate operation, making it faster and more resource-efficient across various use cases.

Related Issue(s)

Related to: #15466

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Copy link
Contributor

vitess-bot bot commented Mar 15, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Mar 15, 2024
@github-actions github-actions bot added this to the v20.0.0 milestone Mar 15, 2024
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 24.33460% with 199 lines in your changes are missing coverage. Please review.

Project coverage is 65.66%. Comparing base (696fe0e) to head (661fe19).
Report is 272 commits behind head on main.

❗ Current head 661fe19 differs from pull request most recent head 725ed0b. Consider uploading reports for the commit 725ed0b to get more accurate results

Files Patch % Lines
go/vt/vtgate/engine/simple_concatenate.go 5.08% 112 Missing ⚠️
go/vt/vtgate/engine/coerce.go 0.00% 71 Missing ⚠️
go/vt/vtgate/planbuilder/operator_transformers.go 83.33% 11 Missing ⚠️
go/vt/vtgate/planbuilder/filter.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15497      +/-   ##
==========================================
- Coverage   67.41%   65.66%   -1.76%     
==========================================
  Files        1560     1564       +4     
  Lines      192752   194693    +1941     
==========================================
- Hits       129952   127837    -2115     
- Misses      62800    66856    +4056     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@systay systay force-pushed the split-concatenate branch 2 times, most recently from afe9522 to 3da7497 Compare March 18, 2024 08:46
Copy link
Collaborator

@vmg vmg left a comment

Choose a reason for hiding this comment

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

very neat. so what would it take now to remove the old concatenate? where is it actually used?

go/vt/vtgate/engine/coerce.go Outdated Show resolved Hide resolved
@systay systay force-pushed the split-concatenate branch 2 times, most recently from cb7a143 to 05b33a9 Compare March 19, 2024 10:03
@systay systay added the Benchmark me Add label to PR to run benchmarks label Mar 21, 2024
Copy link
Contributor

vitess-bot bot commented Mar 21, 2024

Hello! 👋

This Pull Request is now handled by arewefastyet. The current HEAD and future commits will be benchmarked.

You can find the performance comparison on the arewefastyet website.

@systay systay removed NeedsWebsiteDocsUpdate What it says NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Mar 21, 2024
@systay systay force-pushed the split-concatenate branch from 68d8cb2 to 3895f64 Compare March 21, 2024 09:59
Signed-off-by: Andres Taylor <[email protected]>
@systay systay changed the title feat: added simple-concatenate Performance improvements for UNION Mar 21, 2024
Signed-off-by: Andres Taylor <[email protected]>
@systay systay added Backport to: release-19.0 Needs to be back ported to release-19.0 and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request labels Mar 21, 2024
@vmg vmg removed the Benchmark me Add label to PR to run benchmarks label Mar 21, 2024
@systay systay mentioned this pull request Mar 26, 2024
21 tasks
@GrahamCampbell
Copy link
Contributor

Is this aiming for the 19.0.2 release?

@systay systay mentioned this pull request Apr 4, 2024
20 tasks
@systay systay mentioned this pull request Apr 29, 2024
25 tasks
Copy link
Contributor

github-actions bot commented May 4, 2024

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions bot added the Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. label May 4, 2024
@systay
Copy link
Collaborator Author

systay commented May 4, 2024

let's re-open when we have time

@systay systay closed this May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport to: release-19.0 Needs to be back ported to release-19.0 Component: Query Serving Stale Marks PRs as stale after a period of inactivity, which are then closed after a grace period. Type: Regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants