Code: Select all
for PID in $(pgrep "postgres|postmaster") ; do awk '/Pss/ {PSS+=$2} END{getline cmd < "/proc/'$PID'/cmdline"; sub("\0", " ", cmd);printf "%.0f --> %s (%s)\n", PSS, cmd, '$PID'}' /proc/$PID/smaps ; done|sort -n
Code: Select all
(Pss in KB) (PID)
29765 --> postgres: brid_user brid_sba_tdri 127.0.0.1(36624) idle (1892766)
30733 --> postgres: brid_user brid_sba_ict 127.0.0.1(36618) idle (1892760)
33175 --> postgres: brid_user brid_sba_tfg 127.0.0.1(36682) idle (2006367)
40225 --> postgres: brid_user brid_sba_vpg 127.0.0.1(36602) idle (1892746)
42331 --> postgres: brid_user brid_sba_aci 127.0.0.1(36666) idle (1892804)
42582 --> postgres: brid_user brid_sba_bsp 127.0.0.1(36698) idle (1893228)
42598 --> postgres: stats collector (1871510)
46590 --> postgres: brid_user brid_sba_tfg 127.0.0.1(46420) idle (1924863)
51039 --> postgres: brid_user brid_sba_bsp 127.0.0.1(36694) idle (1893226)
55327 --> postgres: brid_user brid_sba_bsp 127.0.0.1(36690) idle (1893225)
58496 --> postgres: brid_user brid_sba_tfg 127.0.0.1(36960) idle (1902283)
60061 --> postgres: brid_user brid_sba_bsp 127.0.0.1(36696) idle (1893227)
144291 --> postgres: brid_user brid_sba_aci 127.0.0.1(51958) SELECT (2106143)
144294 --> postgres: brid_user brid_sba_aci 127.0.0.1(55850) SELECT (2111868)
144295 --> postgres: brid_user brid_sba_aci 127.0.0.1(34990) SELECT (2121512)