i have a simple update query (foo column type is BOOLEAN (default false)):
update tablename set foo = true where id = 234;
which "id" is set to (primary) key, and if i run "explain analyze" i got:
Index Cond: (id = 234)
Total runtime: 0.358 ms
but still, i have plenty of unexplained queries at slow log (pgfouine), which took more than 200s (?!):
Times executed: 99, Av. duration (s): 70
can anyone please explain, whats the reason for that? (1.5 mio rows in table, postgresql 8.4)
idis PK (so there is at most one updated row) this should be practically instantaneous. Either you have some problem (run vacuum analyze verbose) or some other query is locking the whole table... Can't you ideintify those 200s queries in your postgresql log ? Did you set the "log_duration" parameter in your config ?explain analyzewhen it's slow...