Fixed major slowdown due to weird problem with multiple indexes on same
key (pid+iteration and pid).