Re: check database integrity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Torsten Förtsch <torsten(dot)foertsch(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: check database integrity
Date: 2014-07-20 15:35:08
Message-ID: 6850.1405870508@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?ISO-8859-1?Q?Torsten_F=F6rtsch?= <torsten(dot)foertsch(at)gmx(dot)net> writes:
> Then I remembered about the pageinspect extension. The following select
> is a bit too verbose but it seems to do the job for everything except
> fsm files.

> SELECT c.oid::regclass::text as rel,
> f.fork,
> ser.i as blocknr,
> pg.*
> FROM pg_class c
> CROSS JOIN (values ('main'::text), ('vm'::text)) f(fork)
> CROSS JOIN pg_relation_size(c.oid::regclass, f.fork) sz(sz)
> CROSS JOIN generate_series(0,(sz.sz/8192)::int-1) ser(i)
> CROSS JOIN page_header(get_raw_page(c.oid::regclass::text,
> f.fork,
> ser.i)) pg
> WHERE sz.sz>0

> The problem with the select above is that either page_header() or
> get_raw_page() seems to allocate the memory for the page without freeing
> it again.

Probably commit 45b0f3572 will help you with that.

> I ran this query in a separate transaction. The memory was freed only
> when the backend process exited.

AFAIK such memory is released at end of query, even without the patch.
Are you sure you aren't looking at shared-buffer usage? Or maybe you're
on a platform where libc doesn't release freed memory back to the OS.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2014-07-20 17:13:25 Re: Petition: Treat #!... shebangs as comments
Previous Message Tom Lane 2014-07-20 15:28:26 Re: serious issue with age(relfrozenxid)::int.