Re: DB size

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: luis(dot)roberto(at)siscobra(dot)com(dot)br
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: DB size
Date: 2021-04-26 20:45:34
Message-ID: 20210426204534.GA16381@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2021-Apr-26, luis(dot)roberto(at)siscobra(dot)com(dot)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"

In response to

  • DB size at 2021-04-26 20:24:54 from luis.roberto

Responses

Browse pgsql-general by date

  From Date Subject
Next Message luis.roberto 2021-04-26 20:50:49 Re: DB size
Previous Message Josef Šimánek 2021-04-26 20:40:05 Re: DB size