From 6e26b6a4ed681cdefa90695a650bdba8ebe8d5b1 Mon Sep 17 00:00:00 2001 From: Tsubasa SEKIGUCHI Date: Thu, 26 Mar 2026 08:57:00 +0900 Subject: [PATCH] =?UTF-8?q?GetStationsByName=20RPC=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=B3=E3=82=B9=E6=94=B9?= =?UTF-8?q?=E5=96=84=20(#1465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * GetStationsByName RPCのパフォーマンス改善 Co-Authored-By: Claude Opus 4.6 (1M context) * GetStationsByName RPCのパフォーマンス改善 enrichmentフェーズでskip_types_join=trueに変更し、不要なstation_station_types/types テーブルへのLEFT JOINを除去。バス停クエリも並列実行に変更。 _no_typesバリアントではline_group_cdをサブクエリで取得し、has_train_typesが 正しく設定されるよう対応。 Co-Authored-By: Claude Opus 4.6 (1M context) * find_station_by_id, get_stations_by_id_vec, get_stations_by_coordinatesのパフォーマンス改善 line_group_id=None固定の3つのRPCでもskip_types_join=trueに変更し、 不要なstation_station_types/typesテーブルへのLEFT JOINを除去。 Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- stationapi/src/infrastructure/station_repository.rs | 2 +- stationapi/src/use_case/interactor/query.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stationapi/src/infrastructure/station_repository.rs b/stationapi/src/infrastructure/station_repository.rs index 53d3da01..5ecfb6b9 100644 --- a/stationapi/src/infrastructure/station_repository.rs +++ b/stationapi/src/infrastructure/station_repository.rs @@ -1343,7 +1343,7 @@ impl InternalStationRepository { COALESCE(l.average_distance, 0.0)::DOUBLE PRECISION AS average_distance, NULL::int AS sst_id, NULL::int AS type_cd, - NULL::int AS line_group_cd, + (SELECT sst.line_group_cd FROM station_station_types sst WHERE sst.station_cd = s.station_cd AND sst.line_group_cd IS NOT NULL LIMIT 1)::int AS line_group_cd, NULL::int AS pass, NULL::int AS type_id, NULL::text AS type_name, diff --git a/stationapi/src/use_case/interactor/query.rs b/stationapi/src/use_case/interactor/query.rs index bc0d770b..864c7770 100644 --- a/stationapi/src/use_case/interactor/query.rs +++ b/stationapi/src/use_case/interactor/query.rs @@ -72,7 +72,7 @@ where return Ok(None); } let stations = self - .update_station_vec_with_attributes(vec![station], None, transport_type, false) + .update_station_vec_with_attributes(vec![station], None, transport_type, true) .await?; Ok(stations.into_iter().next()) @@ -89,7 +89,7 @@ where .filter(|s| matches_transport_filter(s.transport_type, transport_type)) .collect(); let stations = self - .update_station_vec_with_attributes(stations, None, transport_type, false) + .update_station_vec_with_attributes(stations, None, transport_type, true) .await?; Ok(stations) @@ -161,7 +161,7 @@ where .await?; let stations = self - .update_station_vec_with_attributes(stations, None, transport_type, false) + .update_station_vec_with_attributes(stations, None, transport_type, true) .await?; Ok(stations) @@ -269,7 +269,7 @@ where .await?; let stations = self - .update_station_vec_with_attributes(stations, None, transport_type, false) + .update_station_vec_with_attributes(stations, None, transport_type, true) .await?; Ok(stations)