# PL Profile for pgbench_pl run #1

## PL/pgSQL Call Graph

## List of functions detailed below

- public.tpcb() oid=66237
- public.tpcb_fetch_abalance() oid=66446
- public.tpcb_ins_history() oid=66241
- public.tpcb_upd_accounts() oid=66238
- public.tpcb_upd_branches() oid=66240
- public.tpcb_upd_tellers() oid=66239

## All 6 functions (by self_time)

### Function public.tpcb_upd_accounts() oid=66238 (show)

self_time = 497,398 µs
total_time = 979,064 µs

`public.tpcb_upd_accounts` | `(par_aid integer, par_delta integer)`
`RETURNS integer`

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 20 | 979064 | 56784 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 20 | 496074 | 32131 | `UPDATE pgbench_accounts SET abalance = abalance + par_delta`
`4` | 0 | 0 | 0 | `WHERE aid = par_aid;`
`5` | 20 | 482933 | 24652 | `RETURN tpcb_fetch_abalance(par_aid);`
`6` | 0 | 0 | 0 | `END;`
`7` | 0 | 0 | 0 | ``

### Function public.tpcb_fetch_abalance() oid=66446 (show)

self_time = 481,666 µs
total_time = 481,666 µs

`public.tpcb_fetch_abalance` | `(par_aid integer)`
`RETURNS integer`

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 20 | 481666 | 24362 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `DECLARE`
`3` | 0 | 0 | 0 | `var_abalance integer;`
`4` | 0 | 0 | 0 | `BEGIN`
`5` | 0 | 0 | 0 | `-- SELECT abalance INTO var_abalance`
`6` | 0 | 0 | 0 | `-- FROM pgbench_accounts WHERE aid = par_aid;`
`7` | 0 | 0 | 0 | `-- RETURN var_abalance;`
`8` | 20 | 481354 | 24200 | `RETURN abalance FROM pgbench_accounts WHERE aid = par_aid;`
`9` | 0 | 0 | 0 | `END;`
`10` | 0 | 0 | 0 | ``

### Function public.tpcb_upd_tellers() oid=66239 (show)

self_time = 2,912 µs
total_time = 2,912 µs

`public.tpcb_upd_tellers` | `(par_tid integer, par_delta integer)`
`RETURNS void`

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 20 | 2912 | 505 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 20 | 2857 | 499 | `UPDATE pgbench_tellers SET tbalance = tbalance + par_delta`
`4` | 0 | 0 | 0 | `WHERE tid = par_tid;`
`5` | 0 | 0 | 0 | `END;`
`6` | 0 | 0 | 0 | ``

### Function public.tpcb() oid=66237 (show)

self_time = 2,895 µs
total_time = 986,899 µs

`public.tpcb` | `(par_aid integer, par_bid integer, par_tid integer, par_delta integer)`
`RETURNS integer`

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 20 | 986899 | 58396 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `DECLARE`
`3` | 0 | 0 | 0 | `var_abalance integer;`
`4` | 0 | 0 | 0 | `BEGIN`
`5` | 20 | 979508 | 56923 | `var_abalance = tpcb_upd_accounts(par_aid, par_delta);`
`6` | 20 | 4420 | 773 | `PERFORM tpcb_upd_tellers(par_tid, par_delta);`
`7` | 20 | 1510 | 325 | `PERFORM tpcb_upd_branches(par_bid, par_delta);`
`8` | 20 | 1381 | 371 | `PERFORM tpcb_ins_history(par_aid, par_tid, par_bid, par_delta);`
`9` | 20 | 5 | 1 | `RETURN var_abalance;`
`10` | 0 | 0 | 0 | `END;`
`11` | 0 | 0 | 0 | ``

### Function public.tpcb_upd_branches() oid=66240 (show)

self_time = 1,085 µs
total_time = 1,085 µs

`public.tpcb_upd_branches` | `(par_bid integer, par_delta integer)`
`RETURNS void`

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 20 | 1085 | 235 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 20 | 1045 | 234 | `UPDATE pgbench_branches SET bbalance = bbalance + par_delta`
`4` | 0 | 0 | 0 | `WHERE bid = par_bid;`
`5` | 0 | 0 | 0 | `END;`
`6` | 0 | 0 | 0 | ``

### Function public.tpcb_ins_history() oid=66241 (show)

self_time = 943 µs
total_time = 943 µs

`public.tpcb_ins_history` | `(par_aid integer, par_tid integer, par_bid integer, par_delta integer)`
`RETURNS void`

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 20 | 943 | 280 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 20 | 906 | 278 | `INSERT INTO pgbench_history (tid, bid, aid, delta, mtime)`
`4` | 0 | 0 | 0 | `VALUES (par_tid, par_bid, par_aid, par_delta, CURRENT_TIMESTAMP);`
`5` | 0 | 0 | 0 | `END;`
`6` | 0 | 0 | 0 | ``