File: bench_use_gtt.sql

package info (click to toggle)
pgtt 4.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 536 kB
  • sloc: ansic: 1,547; sql: 569; makefile: 27; sh: 1
file content (17 lines) | stat: -rw-r--r-- 734 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
\set aid random(1, 100000 * :scale)
\set bid random(1, 1 * :scale)
\set tid random(1, 10 * :scale)
\set delta random(-5000, 5000)

-- LOAD 'pgtt';
BEGIN;
INSERT INTO test_tt (id, lbl) SELECT i, md5(i::text) FROM generate_series(1, 1000) i;
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
UPDATE test_tt SET id = id+100 WHERE id > 500;
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
SELECT * FROM test_tt ORDER BY id DESC LIMIT 10;
END;