diff --git a/README.md b/README.md index f674449..95af4d8 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,7 @@ _394 TILs and counting..._ - [List Available Schemas](postgres/list-available-schemas.md) - [List Connections To A Database](postgres/list-connections-to-a-database.md) - [List Database Users](postgres/list-database-users.md) +- [List Various Kinds Of Objects](postgres/list-various-kinds-of-objects.md) - [Max Identifier Length Is 63 Bytes](postgres/max-identifier-length-is-63-bytes.md) - [pg Prefix Is Reserved For System Schemas](postgres/pg-prefix-is-reserved-for-system-schemas.md) - [Pretty Print Data Sizes](postgres/pretty-print-data-sizes.md) diff --git a/postgres/list-various-kinds-of-objects.md b/postgres/list-various-kinds-of-objects.md new file mode 100644 index 0000000..7b14b5e --- /dev/null +++ b/postgres/list-various-kinds-of-objects.md @@ -0,0 +1,15 @@ +# List Various Kinds Of Objects + +Our PostgreSQL database can end up with all kinds of objects: tables, +sequences, views, etc. We can use a variety of `psql` meta-commands to list +the different types of (user-created) objects in our database. + +- `\dt` will list all the tables +- `\dE` will list all the foreign tables +- `\di` will list all the indexes +- `\ds` will list all the sequences +- `\dv` will list all the views +- `\dm` will list all the materialized views + +These can also be combined. For instance, to see all the tables and +sequences, we can run `\dts`.