9

How do I find out what tablespace a table (or index) is in with PostgreSQL (9.3)?

2
  • 2
    pg_tables, pg_indexes Commented Jul 25, 2016 at 9:29
  • \l+ \d+ works .. Commented May 4, 2017 at 1:27

1 Answer 1

17

For example, you have a table example_table (optionally in more than one schema):

SELECT tablespace 
FROM pg_tables 
WHERE tablename = 'example_table' [AND schemaname = 'your_schema'];

The same thing for the index example_index:

SELECT tablespace 
FROM pg_indexes 
WHERE indexname = 'example_index' [AND schemaname = 'your_schema'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.