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

perf(db): optimize N+1 query in comment list #799

Merged
merged 1 commit into from
Mar 17, 2024
Merged

perf(db): optimize N+1 query in comment list #799

merged 1 commit into from
Mar 17, 2024

Conversation

qwqcode
Copy link
Member

@qwqcode qwqcode commented Mar 17, 2024

SCR-20240317-rzta

QPS increased by 46%
Latency reduced by 29%

The test case is the first page of the official website's comment data pagination, SQLITE database (caching is turned off).

@qwqcode qwqcode changed the title perf(db): optimize N+1 query in comment list perf(db): optimize N+1 query in comment list Mar 17, 2024
Copy link

codecov bot commented Mar 17, 2024

Codecov Report

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

Project coverage is 34.83%. Comparing base (44bca8d) to head (12a432b).

Files Patch % Lines
internal/dao/migrate.go 38.70% 19 Missing ⚠️
server/handler/comment_list.go 0.00% 4 Missing ⚠️
internal/dao/cook.go 84.61% 2 Missing ⚠️
server/handler/comment_create.go 0.00% 2 Missing ⚠️
server/handler/stat.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #799      +/-   ##
==========================================
+ Coverage   34.60%   34.83%   +0.23%     
==========================================
  Files         117      117              
  Lines        4757     4805      +48     
==========================================
+ Hits         1646     1674      +28     
- Misses       3004     3024      +20     
  Partials      107      107              
Flag Coverage Δ
go 34.83% <52.45%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@qwqcode qwqcode merged commit b60cb58 into master Mar 17, 2024
7 checks passed
@qwqcode qwqcode deleted the perf/db branch March 17, 2024 13:01
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 this pull request may close these issues.

1 participant