Skip to content

GetStationsByLineGroupIdList RPCのパフォーマンス改善#1459

Merged
TinyKitten merged 1 commit intodevfrom
feature/optimize-get-stations-by-line-group-id-list
Mar 25, 2026
Merged

GetStationsByLineGroupIdList RPCのパフォーマンス改善#1459
TinyKitten merged 1 commit intodevfrom
feature/optimize-get-stations-by-line-group-id-list

Conversation

@TinyKitten
Copy link
Member

@TinyKitten TinyKitten commented Mar 25, 2026

Summary

  • update_station_vec_with_attributesskip_types_jointrueに変更
  • line_group_id=Noneで呼び出すため内部のtrain_type取得は常に空Vecを返しており、station_station_types/typesテーブルへのJOINは不要だった
  • train_typeは後続のtrain_type_repository.get_by_line_group_id_vecで別途取得・上書き済み

改善内容

  • 2つのSQLクエリ(get_stations_by_group_id_vec, get_lines_by_station_group_id_vec)から不要なJOINを削除(_no_typesバリアントに切り替え)
  • バス停クエリがtokio::try_join!で他クエリと並列実行されるようになる

Test plan

  • cargo fmt --check パス
  • cargo clippy 警告なし
  • cargo test 全380テストパス

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • パフォーマンス改善
    • 駅データ取得クエリの効率を向上させました。複数の路線グループIDから駅情報を検索する際のレスポンス時間が改善されます。

update_station_vec_with_attributesのskip_types_joinをtrueに変更。
line_group_id=Noneで呼び出すため内部のtrain_type取得は常に空を返しており、
station_station_types/typesテーブルへのJOINは不要だった。
train_typeは後続のget_by_line_group_id_vecで別途取得済み。

これにより以下が改善される:
- 2つのSQLクエリからstation_station_types/typesへの不要なJOINを削除
- バス停クエリがtokio::try_join!で他クエリと並列実行されるようになる

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the feature 要望対応や課題解決 label Mar 25, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c0cc5473-b6fe-4333-9cad-d7a0a4aff5e9

📥 Commits

Reviewing files that changed from the base of the PR and between cead19d and bfa5e5f.

📒 Files selected for processing (1)
  • stationapi/src/use_case/interactor/query.rs

📝 Walkthrough

Walkthrough

get_stations_by_line_group_id_vec関数のupdate_station_vec_with_attributes(...)呼び出しで、skip_types_join引数がfalseからtrueに変更されました。これは、型データの高コストなJOIN処理をスキップするブランチを使用するように制御フローを変更します。

Changes

Cohort / File(s) Summary
クエリ最適化
stationapi/src/use_case/interactor/query.rs
get_stations_by_line_group_id_vecskip_types_joinパラメータをfalseからtrueに変更。型データの昂コストなJOINを回避しつつ、後続のバッチ処理でtrain_typeを別途取得するフローに最適化。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 ウサギの工夫、参上!
JOINを避けて、高速化
バッチで取得、上手くいく
クエリは軽く、心も軽く
効率の妙、ぴょんと完成!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRタイトルは、skip_types_joinパラメータをfalseからtrueに変更することで実現される、GetStationsByLineGroupIdList RPCのパフォーマンス改善という変更内容を明確に反映しており、変更の主要な目的と直接関連しています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/optimize-get-stations-by-line-group-id-list

Comment @coderabbitai help to get the list of available commands and usage tips.

@TinyKitten TinyKitten self-assigned this Mar 25, 2026
@TinyKitten TinyKitten merged commit c079edb into dev Mar 25, 2026
11 checks passed
@TinyKitten TinyKitten deleted the feature/optimize-get-stations-by-line-group-id-list branch March 25, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 要望対応や課題解決

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant