# PL Profiler Report for tpcb-problem-fixed

## 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_tellers() oid=66239 (show)

self_time = 195,487,118 µs
total_time = 195,487,118 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 44902 | 195487118 | 147832 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 44902 | 195377945 | 147823 | `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_upd_branches() oid=66240 (show)

self_time = 81,747,512 µs
total_time = 81,747,512 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 44901 | 81747512 | 21177 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 44901 | 81639402 | 21174 | `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() oid=66237 (show)

self_time = 3,291,322 µs
total_time = 286,005,315 µ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` | 44901 | 286005315 | 148867 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `DECLARE`
`3` | 0 | 0 | 0 | `var_abalance integer;`
`4` | 0 | 0 | 0 | `BEGIN`
`5` | 44901 | 4817079 | 13903 | `var_abalance = tpcb_upd_accounts(par_aid, par_delta);`
`6` | 44901 | 196304468 | 147862 | `PERFORM tpcb_upd_tellers(par_tid, par_delta);`
`7` | 44901 | 82688022 | 21202 | `PERFORM tpcb_upd_branches(par_bid, par_delta);`
`8` | 44901 | 2048015 | 888 | `PERFORM tpcb_ins_history(par_aid, par_tid, par_bid, par_delta);`
`9` | 44901 | 10028 | 77 | `RETURN var_abalance;`
`10` | 0 | 0 | 0 | `END;`
`11` | 0 | 0 | 0 | ``

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

self_time = 3,086,741 µs
total_time = 4,335,474 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 44902 | 4335474 | 13884 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 44902 | 2512783 | 13813 | `UPDATE pgbench_accounts SET abalance = abalance + par_delta`
`4` | 0 | 0 | 0 | `WHERE aid = par_aid;`
`5` | 44902 | 1761205 | 1168 | `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 = 1,248,733 µs
total_time = 1,248,733 µs

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

Line | exec_count | total_time | longest_time | Source Code
--- | --- | --- | --- | ---
`0` | 44902 | 1248733 | 1121 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `DECLARE`
`3` | 0 | 0 | 0 | `var_abalance integer;`
`4` | 0 | 0 | 0 | `BEGIN`
`5` | 44902 | 1151844 | 1120 | `RETURN abalance FROM pgbench_accounts WHERE aid = par_aid;`
`6` | 0 | 0 | 0 | `END;`
`7` | 0 | 0 | 0 | ``

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

self_time = 1,150,113 µs
total_time = 1,150,113 µ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` | 44901 | 1150113 | 860 | `-- Function Totals`
`1` | 0 | 0 | 0 | ``
`2` | 0 | 0 | 0 | `BEGIN`
`3` | 44901 | 1062122 | 858 | `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 | ``