On Sun, 2008-11-16 at 23:20 +0300, Oleg Serov wrote:
> Wee need to use shared memory for passing one BIGINT value(is session
> throwout triggers), can you advice the method to get/set it with best
> performance ?
have you tried "setval(seq, value)" to set and "select last_value from
seq" to read it.
or just use a table, if concurrency control is important
hannu=# create table shvaltable(id int, value bigint);
CREATE TABLE
Time: 34.704 ms
hannu=# insert into shvaltable values(1,0);
INSERT 0 1
Time: 0.742 ms
hannu=# explain analyse update shvaltable set value=47 where id=1; QUERY
PLAN
-------------------------------------------------------------------------------------------------------Seq Scan on
shvaltable (cost=0.00..34.25 rows=10 width=10) (actual
time=0.015..0.017 rows=1 loops=1) Filter: (id = 1)Total runtime: 0.073 ms
(3 rows)
Time: 3.503 ms
hannu=# explain analyse update shvaltable set value=47 where id=1; QUERY
PLAN
-------------------------------------------------------------------------------------------------------Seq Scan on
shvaltable (cost=0.00..34.25 rows=10 width=10) (actual
time=0.014..0.016 rows=1 loops=1) Filter: (id = 1)Total runtime: 0.058 ms
(3 rows)
Time: 3.298 ms
> 2008/11/16 Tom Lane <tgl@sss.pgh.pa.us>:
> > "Oleg Serov" <serovov@gmail.com> writes:
> >> So, how i must optimize it?
> >
> > The short-term answer seems to be "preload and use plperlu".
> >
> > regards, tom lane
> >
>