Skip to content

Commit 36e8632

Browse files
committed
Merge branch 'master' of github.com:pgexperts/pgx_scripts
2 parents 76862cb + 6d80088 commit 36e8632

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

locks/log_locks.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
# change to path of psql
77
PSQL='/usr/pgsql-9.2/bin/psql'
88

9-
# change to database you're targeting
10-
DBNAME='postgres'
9+
# list all databases you're targeting, space separated
10+
DBNAMES='postgres mydatabase'
1111

1212
# modify if required
1313
DBPORT=''
1414
DBHOST=''
1515

16-
$PSQL -c "SELECT log_transaction_locks();" -U postgres $DBNAME $DBPORT $DBHOST
17-
$PSQL -c "SELECT log_table_locks();" -U postgres $DBNAME $DBPORT $DBHOST
16+
for DBNAME in $DBNAMES; do
17+
$PSQL -c "SELECT log_transaction_locks();" -U postgres $DBNAME $DBPORT $DBHOST
18+
$PSQL -c "SELECT log_table_locks();" -U postgres $DBNAME $DBPORT $DBHOST
19+
done
1820

1921
# $PSQL -c "INSERT INTO activity_log SELECT * FROM pg_stat_activity;" -U postgres $DBNAME $DBPORT $DBHOST
2022

0 commit comments

Comments
 (0)