summaryrefslogtreecommitdiffstats
path: root/pg_upgradecluster.d/analyze
blob: f410365a9bfa8eb87c5414f6e8efcc61ce8b88aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
#
# Run ANALYZE on all databases in the upgraded cluster

set -eu

oldversion="$1"
cluster="$2"
newversion="$3"
phase="$4"

case $newversion in
    9.2|9.3)
        analyze="--analyze-only"
        ;;
    *)
        analyze="--analyze-in-stages"
        ;;
esac

case $newversion in
    9.5|9.6|[1-7]*)
        [ "${PGJOBS:-}" ] && jobs="--jobs=$PGJOBS"
        ;;
esac

case $phase in
    finish)
        vacuumdb --cluster "$newversion/$cluster" --all $analyze ${jobs:-}
        ;;
esac

exit 0