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] bulk create very slow when logging enabled #5520

Closed
zxdvd opened this issue Jul 18, 2022 · 1 comment · Fixed by #5521
Closed

[performance] bulk create very slow when logging enabled #5520

zxdvd opened this issue Jul 18, 2022 · 1 comment · Fixed by #5521
Assignees
Labels

Comments

@zxdvd
Copy link
Contributor

zxdvd commented Jul 18, 2022

GORM Playground Link

go-gorm/playground#1

Description

Bulk create (200 records) is very slow due to logging. The pprof shows following result:

(pprof) top -cum
Showing nodes accounting for 370ms, 59.68% of 620ms total
Showing top 10 nodes out of 63
      flat  flat%   sum%        cum   cum%
         0     0%     0%      460ms 74.19%  gorm.io/gorm.(*DB).Create
         0     0%     0%      460ms 74.19%  gorm.io/gorm.(*processor).Execute
         0     0%     0%      460ms 74.19%  gormtest.TestBulkCreate
         0     0%     0%      460ms 74.19%  testing.tRunner
         0     0%     0%      450ms 72.58%  gorm.io/driver/postgres.Dialector.Explain
         0     0%     0%      450ms 72.58%  gorm.io/gorm.(*processor).Execute.func1
         0     0%     0%      450ms 72.58%  gorm.io/gorm/logger.ExplainSQL
         0     0%     0%      450ms 72.58%  gorm.io/gorm/logger.logger.Trace
         0     0%     0%      450ms 72.58%  strings.Replace
     370ms 59.68% 59.68%      370ms 59.68%  indexbody

The Replace in ExplainSQL took a long time for long string.

@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Jul 18, 2022
@github-actions
Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants