"Qingqing Zhou" <[EMAIL PROTECTED]> writes: > What if we change to cost-based removal, i.e., remove the one whose cost is > smaller. In this case, an two-days-to-be-done reindex should never get > killed.
Instead, it would kill all useful work in your system :-(. An old transaction would be the one invincible gunslinger in town, mowing down every transaction that dared to go up against it, and getting older and even less vincible with every win. Yet this would still not give it any guarantee of ever being able to commit, as long as there's a constant stream of competition. Certainly it's interesting to think about a smarter deadlock-escape algorithm, but that's no solution compared to not getting into a deadlock in the first place. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend