Re: Interesting tight loop

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Theo Schlossnagle <jesus(at)omniti(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Interesting tight loop
Date: 2006-09-14 13:54:07
Message-ID: 28400.1158242047@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Theo Schlossnagle <jesus(at)omniti(dot)com> writes:
> In production today (8.1.4), I ran into a backend process that
> wouldn't cancel right away -- minutes went by.

> It was in

> [0] TransactionIdIsCurrentTransactionId
> [1] HeapTupleSatisfiesSnapshot
> ...

> But the interesting thing is that there were 4.6 million elements in
> the s->childXids list. Which is why it took so damn long.

Well, I don't think TransactionIdIsCurrentTransactionId() itself is to
blame --- the loop over childXids is about as tight as such a loop could
possibly be (two indirect fetches and a comparison per iteration).
Even with 4.6M child Xids it could hardly take a second on any modern
machine. I'm not inclined to add a CHECK_FOR_INTERRUPTS there. The
problem should instead be blamed on something further down the call
stack ... did you save the full stack by any chance?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-09-14 13:57:59 Re: CSStorm occurred again by postgreSQL8.2
Previous Message Tom Lane 2006-09-14 13:40:50 Re: CSStorm occurred again by postgreSQL8.2