5 Ways to List Indexes in PostgreSQL

There are several ways that we can list all indexes in PostgreSQL. These include utilizing various system catalog views and psql commands. Below are five options for returning a list of indexes in PostgreSQL, along with examples of how to filter the results by index name, table name, and other criteria.

Read more

PostgreSQL \di Command Explained

The \di command can be used to list indexes in the current database when using psql (PostgreSQL’s command-line tool). This meta-command can display all indexes, or just indexes that match certain patterns. Here’s an in-depth explanation of how \di works, its options, and examples of its various uses.

Read more

PostgreSQL \dt Command Explained

When using PostgreSQL’s psql command line tool, we can use the \dt command to get a list of tables. This meta-command can display all tables, or just tables that match certain patterns. Below is an overview of how \dt works, its options, and examples of its various uses.

Read more

5 Ways to Enable Vertical Output in psql

When we use psql to write SQL queries in PostgreSQL, we’ll usually see the results presented as a table, with columns displayed vertically and rows running horizontally. But it is possible to change this so that the columns are displayed horizontally and the rows run vertically.

This can be useful for when the number of columns causes the results to be wider than our psql display, and may cause the rows to wrap to the next line.

Here are five ways we can change the display to vertical output, otherwise known as expanded display.

Read more