8

What's the psql command to view all existing tablespaces?

\l+ displays all existing databases with their configured tablespace, but it won't display tablespaces which have been created but don't yet contain a database.

jsstuball
  • 4,104
  • 7
  • 33
  • 63

3 Answers3

7

As documented in the manual, the command to list tablespaces is \db

If you are looking for a command, just enter \? in the psql command line and it will show you all available commands including a short description.

6

PSQL meta-command

\db+

SQL

SELECT * FROM pg_tablespace;
Aashutosh Kumar
  • 615
  • 9
  • 13
2

Here is the psql command that you can use:

postgres=# \db+
                                      List of tablespaces
        Name    |  Owner   | Location | Access privileges | Options |  Size  | Description 
    ------------+----------+----------+-------------------+---------+--------+-------------
     pg_default | postgres |          |                   |         | 448 MB | 
     pg_global  | postgres |          |                   |         | 631 kB | 
    (2 rows)
pifor
  • 7,419
  • 2
  • 8
  • 16