Files
MemRelay/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/坑:大表 SQL 性能与各层超时配套.md
T

21 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 坑:大表 SQL 性能与各层超时配套
type: experience
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/坑大表-sql-性能与各层超时配套
stable_id: 0f19c98d-0d69-4702-af18-e75edae6370a
scope: project
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
memory_type: experience
status: active
revision: 1
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
created_at: '2026-09-23T15:10:04.634428+00:00'
updated_at: '2026-09-23T15:10:04.634497+00:00'
tags:
- pitfall
- sql
- timeout
- performance
---
1) 报表 SQL 对无索引文本列(如 小区名称)做 UPDATE...JOIN,570 万行级别曾跑 >2h——属业务 SQL 本身问题,需加索引优化(尚未做),排查慢查询先看执行计划再怀疑平台。2) 超时链配套:DB 引擎 read/write_timeout=3600s(曾因 30s 默认在 CREATE TABLE AS SELECT 570 万行时 Lost connection);CapacityReport HTTP 客户端导入 upload_timeout=1800s、报表 run_timeout=7200s。改超时要整条链路一起看(DB→平台 API→客户端),单点改了其他层还会断。