Do any of you understand what "pg_stat_get_db_xact_commit" internally does? Even when the application is idle and no requests to the db are sent, the count keeps increasing continuously. Any idea what could be happening in the background?
What version of PostgreSQL are you running? Testing on an idle 8.4.4 install, it doesn't change even after repeated calls. I'm guessing you're running a version prior to 8.3 where read-only commands generated transaction ids.
From the Postgres 8.3 release notes:
Using non-persistent transaction IDs for read-only transactions reduces overhead and VACUUM requirements (Florian Pflug)
Non-persistent transaction IDs do not increment the global transaction counter. Therefore, they reduce the load on pg_clog and increase the time between forced vacuums to prevent transaction ID wraparound. Other performance improvements were also made that should improve concurrency.
So prior to 8.3, simply running "SELECT pg_stat_get_db_xact_commit(oid);" would increment the counter, causing a different result on the next SELECT, even if nothing else was running.