sequences and "addval('myseq', value)" - Mailing list pgsql-hackers

From pgsql@mohawksoft.com
Subject sequences and "addval('myseq', value)"
Date
Msg-id 16880.24.91.171.78.1086665530.squirrel@mail.mohawksoft.com
Whole thread Raw
Responses Re: sequences and "addval('myseq', value)"
List 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.




pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: vacuumdb: vacuuming of database "testdonors" failed: ERROR: invalid memory alloc request size 3221225472
Next
From: pgsql@mohawksoft.com
Date:
Subject: Re: vacuumdb: vacuuming of database "testdonors" failed: