문제

I have a Postgres 8.3 instance with tablespaces totalling on about 74G. This is fine.

But if I ask postgres how big my database is, I get a (unexpected) large answer: 595 GB.

This seems very strange. Disk I/O tests on the system are in the 'normal' range, but queries are slower than they used to be.

Is this corruption of the database? Or are there ways to 'fix' this oddity?

[Edit] I check the tablespace size by the os:

/usr/local/pgsql/data/tblspaces/du -c -h
74G total 

All tablespaces are there

I check te database size like this:

select pg_size_pretty(pg_database_size('database')) 

[Edit2]

I also checked the entire /usr/local/pgsql/ dir. It is 76 G

And I ran this query:

select
  tablename
, pg_relation_size(tablename)
, pg_size_pretty(pg_relation_size(tablename) ) as relsize
, pg_size_pretty(pg_total_relation_size(tablename) ) as disksize
, pg_total_relation_size(tablename)
from pg_tables where schemaname <> 'information_schema'
order by 2 desc

Which returned 'normal' relationsizes, none of which exceeded the disksize.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top