Merged
Conversation
- WorkUpdatedAt フィールドを削除(ORDER BYのみで使用、API応答には不要) - aggregateWorkListRows → mapRowsToWorkList に名称変更 - aggregateWorkDetailRows → mapRowsToWorkDetail に名称変更 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
spec-core | a6cd157 | Commit Preview URL Branch Preview URL |
Jan 25 2026, 08:26 AM |
There was a problem hiding this comment.
Pull request overview
このPRは、作品取得時に発生していたN+1クエリ問題を修正し、個別クエリを結合クエリに置き換えることでパフォーマンスを改善します。
Changes:
- 作品一覧・詳細取得時の著者、タグ、ファイル情報を個別クエリからJOINベースの一括取得に変更
- 不要なヘルパー関数(
getWorkWorkTagList、getWorkWorkFileList)と対応するSQLファイルを削除 - 結合結果を集約する新しいマッピング関数(
mapRowsToWorkList、mapRowsToWorkDetail)を追加
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/work/get_work_work_work_id.go | 作品詳細取得をJOINベースのクエリに変更し、結果を集約するmapRowsToWorkDetail関数を追加 |
| pkg/work/get_work_work.go | 作品一覧取得をJOINベースのクエリに変更し、結果を集約するmapRowsToWorkList関数を追加 |
| pkg/work/get_user_user_id_work.go | ユーザー作品一覧取得で新しい共通クエリと集約関数を使用するように変更 |
| pkg/db/sql/work/select_work_with_relations.sql | 作品、著者、タグを一度に取得する新しいSQLクエリを追加 |
| pkg/db/sql/work/select_work_from_work_id_with_relations.sql | 作品詳細、著者、タグ、ファイルを一度に取得する新しいSQLクエリを追加 |
| pkg/db/sql/work/select_work_work_tag.sql | 不要になったタグ個別取得クエリを削除 |
| pkg/db/sql/work/select_work_work_file.sql | 不要になったファイル個別取得クエリを削除 |
| pkg/db/sql/work/select_work_from_work_id.sql | 不要になった作品基本情報取得クエリを削除 |
| pkg/db/sql/work/select_work.sql | 不要になった作品一覧取得クエリを削除 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

close #235
Summary
Test plan
GET /work/workで作品一覧が正常に取得できることGET /work/work/{workId}で作品詳細が正常に取得できることGET /user/{userId}/workでユーザーの作品一覧が正常に取得できること