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 optimization of GenUpdateSQL with multi updates #8057

Closed
2 tasks
amyangfei opened this issue Jan 11, 2023 · 3 comments
Closed
2 tasks

Performance optimization of GenUpdateSQL with multi updates #8057

amyangfei opened this issue Jan 11, 2023 · 3 comments
Assignees
Labels
affects-6.5 area/ticdc Issues or PRs related to TiCDC. type/feature Issues about a new feature

Comments

@amyangfei
Copy link
Contributor

amyangfei commented Jan 11, 2023

Is your feature request related to a problem?

In a large update transaction scenario, we found high cpu usage with github.com/pingcap/tiflow/pkg/sqlmodel.GenUpdateSQL (24.45%, 33.79s)

image

cpu profile: cdc.profile.zip

Describe the feature you'd like

Break down sub tasks

  • Add more unit test cases to cover gen multi update scenario
  • Add a GenUpdateSQLFast function to replace GenUpdateSQL, which remove the ast.Restore procedure, and generate SQL with template rendering.

Describe alternatives you've considered

No response

Teachability, Documentation, Adoption, Migration Strategy

No response

@amyangfei amyangfei added area/ticdc Issues or PRs related to TiCDC. type/feature Issues about a new feature labels Jan 11, 2023
@amyangfei amyangfei self-assigned this Jan 11, 2023
@lance6716
Copy link
Contributor

lance6716 commented Jan 11, 2023

there's also other ways to avoid CPU consumption, like

  • don't need to generate for columns that are not changed
  • cache the SQL per table, and invalidate it after DDL
  • split into DELETE + INSERT
  • use GenInsertSQL with DMLInsertOnDuplicateUpdate when PK/UK is not updated (as in the comment of GenUpdateSQL)

@nongfushanquan
Copy link
Contributor

/label affects-6.5

@amyangfei
Copy link
Contributor Author

This issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 area/ticdc Issues or PRs related to TiCDC. type/feature Issues about a new feature
Projects
None yet
Development

No branches or pull requests

4 participants