#!/usr/bin/env bash # v02-matrix.sh # # What the progress views show for a backend while it runs commands that nest # one progress report inside another (file_fdw scans, COPY in triggers, # REPACK/CLUSTER/VACUUM FULL rebuilding indexes), and what is left behind # after errors. # # It creates a throw-away cluster in with the binaries in # (file_fdw must be installed there), writes the data files there (about # 130 MB), and runs each cell in its own new session while a second session # samples pg_stat_progress_{analyze,copy,create_index,vacuum,repack} for that # backend every ~0.5 ms, calling pg_stat_clear_snapshot() between samples. # The cluster is stopped at the end. # # Two kinds of cells: # cell one psql -c; sampling stops when the backend # goes idle (same as cf6958-matrix.sh). # series ... one psql session runs the statements in order; # before statement i it sets application_name to # /i, so each sample is tagged with the # step it was taken in. Idle samples are kept and # tagged "idle:". Errors do not stop the session. # # Output per cell: "count N