| 26 | |
| 27 | |
| 28 | == Sprawdzenie ile pamięci RAM zajmuje Postgres == |
| 29 | {{{ |
| 30 | #ps -u postgres o pid= | sed 's#.*#/proc/&/smaps#' | xargs sudo grep ^Pss: | awk '{A+=$2} END{print A}' |
| 31 | }}} |
| 32 | |
| 33 | Wynik podawany jest w kB, na podstawie analizy plików smaps |
| 34 | |
| 35 | == Sprawdzenie aktualnie wykonywanych zapytań == |
| 36 | |
| 37 | {{{ |
| 38 | postgres@edokumenty:~$psql |
| 39 | |
| 40 | SELECT (now() - pg_stat_activity.xact_start) AS age, |
| 41 | pg_stat_activity.datname, pg_stat_activity.procpid, |
| 42 | pg_stat_activity.usename, pg_stat_activity.waiting, |
| 43 | pg_stat_activity.query_start, pg_stat_activity.client_addr, |
| 44 | pg_stat_activity.client_port, pg_stat_activity.current_query |
| 45 | FROM pg_stat_activity |
| 46 | WHERE (pg_stat_activity.xact_start IS NOT NULL) |
| 47 | ORDER BY pg_stat_activity.xact_start; |
| 48 | |
| 49 | }}} |