# HG changeset patch # User Oleksandr Gavenko # Date 1546536978 -7200 # Node ID 03d20db65d79d59602f40d1dc10869679ae5ab62 # Parent 738316fb865f5089c986c52bdfa4bda8d2beefd7 List indexes/constraints. diff -r 738316fb865f -r 03d20db65d79 postgres.rst --- a/postgres.rst Thu Jan 03 09:39:56 2019 +0200 +++ b/postgres.rst Thu Jan 03 19:36:18 2019 +0200 @@ -83,6 +83,12 @@ ALTER USER me WITH PASSWORD 'PassWord'; +Monitor connections +=================== +:: + + select * from pg_stat_activity; + List databases, schemas and tables ================================== @@ -180,6 +186,21 @@ t.relname, i.relname; +List index usage:: + + SELECT * FROM pg_stat_all_indexes; + SELECT * FROM pg_stat_all_tables; + SELECT * FROM pg_stat_user_indexes; + SELECT * FROM pg_stat_user_tables; + +List constraints:: + + SELECT * FROM pg_constraint; + SELECT * FROM pg_constraint WHERE conrelid = (SELECT oid FROM pg_class WHERE relname LIKE 'tblName'); + +https://www.postgresql.org/docs/current/catalog-pg-constraint.html + pg_constraint. + List functions:: \df