Re: DB size - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: DB size
Date
Msg-id 20210426204534.GA16381@alvherre.pgsql
Whole thread Raw
In response to DB size  (luis.roberto@siscobra.com.br)
Responses Re: DB size  (luis.roberto@siscobra.com.br)
Re: DB size  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
On 2021-Apr-26, luis.roberto@siscobra.com.br wrote:

>   SELECT sum(pg_total_relation_size(relid)), 
>          pg_size_pretty(sum(pg_total_relation_size(relid)))
>     FROM pg_catalog.pg_stat_all_tables 
> 
> 
> sum         |pg_size_pretty|
> ------------+--------------+
> 518549716992|483 GB        |
> 
> 
>     SELECT pg_database_size('mydb'),
>        pg_size_pretty(pg_database_size('mydb'))
> 
> 
> pg_database_size|pg_size_pretty|
> ----------------+--------------+
>     869150909087|809 GB        |
> 
> There are three databases in the cluster, apart from 'mydb' (one of
> them is the 'postgres' database). These other two size about 8MB each.

I would guess that there are leftover files because of those crashes you
mentioned.  You can probably look for files in the database subdir in
the data directory that do not appear in the pg_class.relfilenode
listing for the database.

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
<inflex> really, I see PHP as like a strange amalgamation of C, Perl, Shell
<crab> inflex: you know that "amalgam" means "mixture with mercury",
       more or less, right?
<crab> i.e., "deadly poison"



pgsql-general by date:

Previous
From: Josef Šimánek
Date:
Subject: Re: DB size
Next
From: luis.roberto@siscobra.com.br
Date:
Subject: Re: DB size