Check extensions.
--- a/postgres.rst Wed Jan 02 00:59:05 2019 +0200
+++ b/postgres.rst Thu Jan 03 00:32:48 2019 +0200
@@ -61,6 +61,12 @@
SELECT name, setting FROM pg_settings;
+Check extensions
+================
+::
+
+ SELECT * FROM pg_available_extensions;
+
List databases, schemas and tables
==================================
@@ -81,14 +87,14 @@
Schemas::
- => select schema_name from information_schema.schemata;
- => select nspname from pg_catalog.pg_namespace;
- => \dn *
+ \dn *
+ select schema_name from information_schema.schemata;
+ select nspname from pg_catalog.pg_namespace;
To list all tables in the current database::
- => SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;
- => \dt
+ \dt
+ SELECT table_schema, table_name FROM information_schema.tables ORDER BY table_schema, table_name;
or in all schemas::
@@ -110,6 +116,10 @@
List indexes::
\di
+ select * from pg_indexes;
+ select * from pg_indexes where schemaname = '...';
+ select * from pg_indexes where schemaname = '...' and tablename = '...';
+ select * from pg_indexes where schemaname = '...' and indexname = '...';
List functions::
@@ -175,6 +185,13 @@
SELECT xmin, xmax, * FROM foo WHERE id < 5 ORDER BY id;
+Vacuum
+======
+
+Stats on vacuum oprtations per table::
+
+ select * from pg_stat_user_tables;
+
Using psql client
=================