Re: sequences and "addval('myseq', value)"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql(at)mohawksoft(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sequences and "addval('myseq', value)"
Date: 2004-06-08 13:35:13
Message-ID: 659.1086701713@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pgsql(at)mohawksoft(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-06-08 13:51:46 Re: Question regarding dynamic_library_path
Previous Message Jan Wieck 2004-06-08 12:46:59 Re: [GENERAL] The pgreplication project