chezmoi/bin/executable_scan-for-bad-indexes.sh
kjuulh 31d7ef27a8
Add bin/devhamctl
Add bin/docker-traverse.sh
Add bin/exec-sanity.sh
Add bin/lunardev.sh
Add bin/record.sh
Add bin/restart-builds-drone.sh
Add bin/run-dosier.sh
Add bin/sanity.sh
Add bin/scan-for-bad-indexes.sh
Add bin/ssh-agent.sh
Add bin/terraform.sh
Add bin/tmux.sh
Add bin/update-vault.sh
Add bin/zimfwupdate.sh
2023-07-24 12:42:39 +02:00

25 lines
460 B
Bash

#!/bin/bash
set -e
psql -AtF',' -c 'SELECT datname FROM pg_database WHERE datistemplate = false;' | rg -v rdsadmin |
while read -r line
do
echo "running for $line"
psql -d "$line" -AtF',' -c '
SELECT pg_class.relname
FROM pg_class, pg_index
WHERE pg_index.indisvalid = false
AND pg_index.indexrelid = pg_class.oid;'
echo
done
#psql <<EOF
#EOF
#SELECT pg_class.relname
#FROM pg_class, pg_index
#AND pg_index.indexrelid = pg_class.oid;