# PL Profiler Report for tpcb-using-collect

## 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_fetch_abalance() oid=66446 (show)

self_time = 3,310,825,465 µs
total_time = 3,310,825,465 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 39631 | 3310825465 | 189444 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `DECLARE`
`3` | 0 | 0 | 0 | `var_abalance integer;`
`4` | 0 | 0 | 0 | `BEGIN`
`5` | 39631 | 3309500618 | 189433 | `RETURN abalance FROM pgbench_accounts WHERE aid = par_aid;`
`6` | 0 | 0 | 0 | `END;`
`7` | 0 | 0 | 0 | ``

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

self_time = 2,870,372,449 µs
total_time = 6,181,197,914 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 39631 | 6181197914 | 327997 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 39631 | 2860073982 | 240772 | `UPDATE pgbench_accounts SET abalance = abalance + par_delta`
`4` | 0 | 0 | 0 | `WHERE aid = par_aid;`
`5` | 39631 | 3320466732 | 189511 | `RETURN tpcb_fetch_abalance(par_aid);`
`6` | 0 | 0 | 0 | `END;`
`7` | 0 | 0 | 0 | ``

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

self_time = 393,465,416 µs
total_time = 393,465,416 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 39631 | 393465416 | 126917 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 39631 | 392808913 | 126909 | `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_upd_tellers() oid=66239 (show)

self_time = 175,842,662 µs
total_time = 175,842,662 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 39631 | 175842662 | 128055 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 39631 | 175232470 | 128044 | `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 = 20,614,676 µs
total_time = 6,774,775,742 µ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` | 39631 | 6774775742 | 337476 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `DECLARE`
`3` | 0 | 0 | 0 | `var_abalance integer;`
`4` | 0 | 0 | 0 | `BEGIN`
`5` | 39631 | 6183022911 | 328022 | `var_abalance = tpcb_upd_accounts(par_aid, par_delta);`
`6` | 39631 | 187248326 | 128141 | `PERFORM tpcb_upd_tellers(par_tid, par_delta);`
`7` | 39631 | 397381932 | 126953 | `PERFORM tpcb_upd_branches(par_bid, par_delta);`
`8` | 39631 | 6545280 | 52291 | `PERFORM tpcb_ins_history(par_aid, par_tid, par_bid, par_delta);`
`9` | 39631 | 24333 | 6280 | `RETURN var_abalance;`
`10` | 0 | 0 | 0 | `END;`
`11` | 0 | 0 | 0 | ``

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

self_time = 3,655,074 µs
total_time = 3,655,074 µ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` | 39631 | 3655074 | 52254 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 39631 | 3416781 | 52243 | `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 | ``