pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to determine which file contains which block
3+ messages / 2 participants
[nested] [flat]

* How to determine which file contains which block
@ 2004-01-28 21:37  Frank Way <fgw_three@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Frank Way @ 2004-01-28 21:37 UTC (permalink / raw)
  To: pgsql-admin; +Cc: fgw_three@yahoo.com

Hi all,

I've recently had the opportunity to use pg_filedump to try and find
some corruption in one of my database tables (7.3.4).

If found the following description of how to find the block/tuple and
to use pg_filedump:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=20030922162322.E12708%40quart...

It was quite good but left one gap that I've not been able to figure
out.

After finding the ctid in (block,tuple) format, how do you know which
file in all the subdirectories under /usr/local/pgsql/data/base
contains that block?

I'm a bit ashamed to say I found it through trial and error.  There has
to be a better way <grin>.

I've looked through the documentation, but haven't found anything on
this subject.


Thanks for your help,
Frank Way


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to determine which file contains which block
@ 2004-01-28 22:45  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Frank Way <fgw_three@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2004-01-28 22:45 UTC (permalink / raw)
  To: Frank Way <fgw_three@yahoo.com>; +Cc: pgsql-admin

Frank Way <fgw_three@yahoo.com> writes:
> After finding the ctid in (block,tuple) format, how do you know which
> file in all the subdirectories under /usr/local/pgsql/data/base
> contains that block?

The subdirectories are named after the OIDs of their databases
(pg_database.oid column).  Individual files are named after the
relfilenodes of their tables/indexes (pg_class.relfilenode).
Note also that tables exceeding 1GB will be broken into gigabyte-size
segments named nnn, nnn.1, nnn.2, etc; if you are dealing with one
of these then you need to determine which segment to use from the
block number.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to determine which file contains which block
@ 2004-01-29 14:09  Frank Way <fgw_three@yahoo.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Frank Way @ 2004-01-29 14:09 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin


--- Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Frank Way <fgw_three@yahoo.com> writes:
> > After finding the ctid in (block,tuple) format, how do you know
> which
> > file in all the subdirectories under /usr/local/pgsql/data/base
> > contains that block?
> 
> The subdirectories are named after the OIDs of their databases
> (pg_database.oid column).  Individual files are named after the
> relfilenodes of their tables/indexes (pg_class.relfilenode).
> Note also that tables exceeding 1GB will be broken into gigabyte-size
> segments named nnn, nnn.1, nnn.2, etc; if you are dealing with one
> of these then you need to determine which segment to use from the
> block number.
> 
> 			regards, tom lane
> 

Thanks Tom, your answer is MUCH appreciated.....

frank



=====
Frank Way
E-Mail: fgw_three@yahoo.com

"Place guards on all the roads and keep the troops 
from running to the rear..." MG John Buford, 1863

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-01-29 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-01-28 21:37 How to determine which file contains which block Frank Way <fgw_three@yahoo.com>
2004-01-28 22:45 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-01-29 14:09   ` Frank Way <fgw_three@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox