-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
create table a (id int primary key, info text, crt_time timestamp) using undam;
create or replace function upserta(int) returns void as $$
declare
begin
update a set info=random()::text,crt_time=now() where id=$1;
if not found then
insert into a values ($1,random()::text,now());
end if;
exception when others then
update a set info=random()::text,crt_time=now() where id=$1;
end;
$$ language plpgsql strict;
vi test.sql
\set id random(1,10000000)
select upserta(:id);
pgbench -M prepared -n -r -P 1 -f ./test.sql -c 32 -j 32 -T 1200
Metadata
Metadata
Assignees
Labels
No labels