PostgreSQL tablespace size is bigger than database size. What is the problem about that?

SELECT pg_size_pretty(pg_database_size('ibidev'));
 2578 MB
(1 row)

SELECT pg_size_pretty(pg_tablespace_size('tbs_ibi_dat'));
 47 GB
(1 row)

Using PostgreSQL 9.1


A tablespace can contain tables from more than one database.

The extra space must be from another database.


I have identified the problem: it was caused by pgsql_tmp dir in the tbs_ibi_dat tablespace. I ran a bad query with many sorting data so PostgreSQL stored that sorting data in that directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.