From 981b501bdd8084c349f7aaf24ed5750ea378beed Mon Sep 17 00:00:00 2001 From: claude_dev Date: Mon, 24 Aug 2026 14:16:21 +0800 Subject: [PATCH] =?UTF-8?q?docs(data):=20get=5Fsecurity=5Finfo=5Fbatch=20d?= =?UTF-8?q?ocstring=E5=90=8C=E6=AD=A5=E5=8F=8Cseek=E7=BB=88=E6=80=81?= =?UTF-8?q?=E2=80=94=E2=80=94=E5=88=A0'IN+GROUP=20BY=E8=B5=B0=E7=B4=A2?= =?UTF-8?q?=E5=BC=95'=E6=97=A7=E6=8F=8F=E8=BF=B0(=E8=AF=A5=E5=81=87?= =?UTF-8?q?=E8=AE=BE=E6=81=B0=E4=B8=BA=E7=94=9F=E4=BA=A7=E5=8A=A3=E5=8C=96?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=A0=B9=E6=BA=90)=20[vps]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanguo_portfolio/providers/local_unified_provider.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sanguo_portfolio/providers/local_unified_provider.py b/sanguo_portfolio/providers/local_unified_provider.py index 5111fda..fa271bf 100644 --- a/sanguo_portfolio/providers/local_unified_provider.py +++ b/sanguo_portfolio/providers/local_unified_provider.py @@ -669,9 +669,11 @@ class LocalUnifiedProvider(DataProvider): # type: ignore[misc] filters.filter_st_stock / filter_new_stock 逐只调 get_security_info, 每只 2 条 SQL(dbbardata min/max + constituent_unified name); 03 每日 10 行业×几百只、02/01 - 调仓千次 → 万次查询。本方法一次查全: - - dbbardata: ``symbol IN (...) GROUP BY symbol, exchange`` 拿 min/max(走索引) - - constituent_unified: ``code IN (...)`` 拿 code_name + 调仓千次 → 万次查询。本方法: + - dbbardata: 逐对双 seek(ORDER BY ±datetime LIMIT 1, 见 _minmax_seek_sql)拿 + min/max——IN+GROUP BY 形态在无统计信息库会被选去单列 interval 索引整扫 + (2026-08-24 生产实锤 30 只冷 101s); 双 seek 每股恰 2 次寻位(实测 0.004s/30 只) + - constituent_unified: ``code IN (...)`` 拿 code_name(批量不变) 返回 {jq_code: {code, display_name, name, start_date, end_date, type}}, 与逐只逐字一致。 """ if not securities: