我想弄清楚为什么一个UPDATE
语句需要太长时间(> 30 秒)。
这是随机的,即在大多数情况下,它在 100 毫秒内完成。但是,有时(随机)需要> 30 秒才能完成。
一些细节:
REINDEX
ing、VACUUM
ing(和VACUUM ANALYZE
),但没有任何改进log_lock_waits
) 但我什么也没看到。查询:
UPDATE "my_table" SET "match_request_id" = 'c607789f-4816-4a38-844b-173fa7bf64ed'::uuid WHERE "my_table"."id" = 129624354;
Run Code Online (Sandbox Code Playgroud)
的输出 EXPLAIN (ANALYZE VERBOSE BUFFERS COSTS)
Update on public.my_table (cost=0.56..8.58 rows=1 width=832) (actual time=34106.965..34106.966 rows=0 loops=1)
Buffers: shared hit=431280 read=27724
I/O Timings: read=32469.021
-> Index Scan using my_table_pkey on …
Run Code Online (Sandbox Code Playgroud)