Skip to content

Instantly share code, notes, and snippets.

@digi0ps
Last active April 19, 2020 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digi0ps/8d1d336579bee74c4cfe7b5c834f006b to your computer and use it in GitHub Desktop.
Save digi0ps/8d1d336579bee74c4cfe7b5c834f006b to your computer and use it in GitHub Desktop.
Postgres testing with an active connection
#! /bin/zsh
zmodload zsh/datetime
start=$EPOCHREALTIME
PGPASSWORD=password psql -U localadmin testing \
-c "DO
\$do\$
BEGIN
FOR i IN 1..100 LOOP
perform count(*) from pg_stat_activity;
END LOOP;
END
\$do\$;" > /dev/null;
end=$EPOCHREALTIME
echo "Elapsed Time: $((end-start))";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment