The following is a high list of queries to employ when troubleshooting performance, display and configuration issues related to Postgres,
DX O2 2* OnPremise
a) obtain the postgres pod name
kubectl get pods -n<namespace> | grep post
Example:
kubectl get pods -ndxi | grep post
dxi-postgres-7bc9cff448-zhg9f 1/1 Running 0 178m
dxi-postgres-schema-5ffcbbf746-z4dvq 1/1 Running 0 177m
b) login to pod
kubectl exec -it <postgresql-pod> -n<namespace> -- bash
Example:
kubectl exec -it postgresql-77c878cc47-76hwm -ndxi -- bash
psql -l
Example:
List of databases
Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
---------------+----------+----------+-----------------+---------+---------+------------+-----------+-----------------------
aoplatform_db | aopuser | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =Tc/aopuser +
| | | | | | | | aopuser=CTc/aopuser
doi_db | aopuser | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =Tc/aopuser +
| | | | | | | | aopuser=CTc/aopuser
grafana_db | aopuser | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =Tc/aopuser +
| | | | | | | | aopuser=CTc/aopuser
postgres | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | |
template0 | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =c/postgres +
| | | | | | | | postgres=CTc/postgres
psql -d database -U user -W
Example:
psql -U aopuser -d aoplatform_db
\c dbname
Example:
\c aoplatform_db aopuser
\l+
\d+
\d table_name
for example:
\d aradminbasicauthuser
\s
\?
\q