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

From: pgsql(at)mohawksoft(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: sequences and "addval('myseq', value)"
Date: 2004-06-08 03:32:10
Message-ID: 16880.24.91.171.78.1086665530.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have an idea, let me know what you all think.

rather than do:

select sum( field) from largetable

I want (need) to be able to do something like this:

select setval('myseq', select sum(field) from largetable);

and in a trigger

SELECT addval('myseq', field_size);

I have already created this function and am testing it. I basically took
"nextval" and assigned "byval" to a parameter and removed the value
caching code.

Anyway, I'm not quite getting the idea of caching sequence values. I
understand the performance benefits, but it seems problematic across
multiple backends, almost ensuring "holes" in the sequence of numbers.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message pgsql 2004-06-08 03:36:51 Re: vacuumdb: vacuuming of database "testdonors" failed:
Previous Message Joshua D. Drake 2004-06-08 02:18:59 vacuumdb: vacuuming of database "testdonors" failed: ERROR: invalid memory alloc request size 3221225472