pgsql@mohawksoft.com writes:
> The question is, what do you think of an "addval" function for sequences.
It would have to be defined as "do the same thing as N successive
nextval calls would do", which would not be especially useful in the
presence of caching.
> The problem I, and I know many other people are having, is that large sums
> can not be obtained without a table scan. A summary table can be created,
> but if you have any sort of volume, you have to vacuum the summary table
> constantly.
> Using the sequence construct as sort of an accumulator just might fit the
> bill for this sort of thing.
How would it work at all? Suppose your transaction rolls back after
doing the insert or update. The table won't have changed ... but the
sequence change doesn't roll back. You can't make such an easy end run
around the fundamental MVCC/locking problem.
regards, tom lane