
BEGIN;
PREPARE sel(integer) AS SELECT count(*) FROM contend WHERE id BETWEEN $1 AND $1 + 100;
PREPARE ist(integer) AS insert into contend values ($1+1000000, 1);
PREPARE upd(integer) AS UPDATE contend SET val = val + 1 WHERE id = $1;

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);
SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE ist(10 * :rnd + :client_id);

SAVEPOINT a;
\set rnd random(1,99990)
EXECUTE sel(10 * :rnd + :client_id + 1);
EXECUTE upd(10 * :rnd + :client_id);

DEALLOCATE ALL;
COMMIT;
