mat*_*ija 5 postgresql indexing performance execution
我有一个简单的更新查询(foo 列类型是 BOOLEAN(默认为 false)):
update tablename set foo = true where id = 234;
Run Code Online (Sandbox Code Playgroud)
其中“id”设置为(主)键,如果我运行“解释分析”,我得到:
Index Cond: (id = 234)
Total runtime: 0.358 ms
Run Code Online (Sandbox Code Playgroud)
但是,我在慢日志 (pgfouine) 中有很多无法解释的查询,耗时超过 200 秒(?!):
Times executed: 99, Av. duration (s): 70
Run Code Online (Sandbox Code Playgroud)
谁能解释一下,这是什么原因?(表中的 1.5 个 mio 行,postgresql 8.4)