in reply to Running total with SQL

Your question is soo vague, and soo not about perl, I'm not sure what your asking. Does PostgreSQL have triggers? If so, maybe you could create some update/insert/delete triggers to update the total everytime there's activity somewhere else.