• Home
  • Services
    • HR Services
      • HR Advisory Services
      • Contract Staffing
      • HR Outsourcing Services
      • Manpower Supply Services
      • Payroll Processing
      • Permanent Placement
      • Recruitment and Placement Services
      • Recruitment Process Outsourcing
      • Staffing Agency Services
    • DBA Support
      • DBA Consultancy Services
      • PostgreSQL Support
    • Website Maintenance
    • Company Registration Services
    • Virtual Office Space Address
  • Company
    • FAQs
    • About Us
    • Contact
  • Office Space
    • Virtual Space
    • Co-working Space
    • Private Space
    • Meeting Room
    • Locations
    • Add Listing
    • Dashboard
  • Blogs
  • Careers
    • Jobseeker
    • Employer
  • Courses

    About Courses

    • List Of Courses
    • Become an Instructor
    Greenplum

    Greenplum

    $1,500.00
    Read More
    Have any question?
    (+91)8148383856
    info@rayafeel.com
    Login
    RayaFeeL
    • Home
    • Services
      • HR Services
        • HR Advisory Services
        • Contract Staffing
        • HR Outsourcing Services
        • Manpower Supply Services
        • Payroll Processing
        • Permanent Placement
        • Recruitment and Placement Services
        • Recruitment Process Outsourcing
        • Staffing Agency Services
      • DBA Support
        • DBA Consultancy Services
        • PostgreSQL Support
      • Website Maintenance
      • Company Registration Services
      • Virtual Office Space Address
    • Company
      • FAQs
      • About Us
      • Contact
    • Office Space
      • Virtual Space
      • Co-working Space
      • Private Space
      • Meeting Room
      • Locations
      • Add Listing
      • Dashboard
    • Blogs
    • Careers
      • Jobseeker
      • Employer
    • Courses

      About Courses

      • List Of Courses
      • Become an Instructor
      Greenplum

      Greenplum

      $1,500.00
      Read More

      Blog

      • Home
      • Blog
      • Blog
      • how to find out the database and table a file path refers to on PostgreSQL database ?

      how to find out the database and table a file path refers to on PostgreSQL database ?

      • Posted by Nijamutheen J
      • Categories Blog
      • Date January 16, 2019
      • Comments 0 comment
      PostgreSQL cluster 2.svg

      how to find out the database and table a file path refers to on PostgreSQL database ?

      There are three main patterns for paths:

      • 1.For files in the default tablespace: base/database_oid/filenode id for the relation
      • 2.For files in Non-default tablespace: pg_tblspc / tablespace_oid / tablespace_version_subdir / database_oid / filenode id for the relation
      • 3.For shared relations (see below): global/filenode id for the relation
      1.For files in the default tablespace:
      Tables’ file names aren’t necessarily the same as their oids in pg_class and  can change when VACUUM FULL, TRUNCATE, etc are run.
      For example:

      billing_db=# \dt+
                          List of relations
       Schema | Name | Type  |  Owner   |  Size   | Description
      --------+------+-------+----------+---------+-------------
       public | t1   | table | postgres | 0 bytes |
      (1 row)
      
      billing_db=# SELECT pg_relation_filepath('t1');
       pg_relation_filepath
      ----------------------
       base/18144/18146
      (1 row)
      
      billing_db=# insert into t1 values(2);
      INSERT 0 1
      billing_db=# insert into t1 values(2);
      INSERT 0 1
      billing_db=# insert into t1 values(2);
      INSERT 0 1
      
      billing_db=# SELECT pg_relation_filepath('t1');
       pg_relation_filepath
      ----------------------
       base/18144/18146
      (1 row)
      
      billing_db=# update t1 set id=1;
      UPDATE 3
      billing_db=# SELECT pg_relation_filepath('t1');
       pg_relation_filepath
      ----------------------
       base/18144/18146
      (1 row)
      
      
      billing_db=# vacuum t1;
      VACUUM
      
      billing_db=# SELECT pg_relation_filepath('t1');
       pg_relation_filepath
      ----------------------
       base/18144/18146
      (1 row)
      
      billing_db=# vacuum full t1;
      VACUUM
      
      billing_db=# SELECT pg_relation_filepath('t1');
       pg_relation_filepath
      ----------------------
       base/18144/18149
      (1 row)
      2.Non-default tablespace paths:

      SELECT pg_relation_filepath('t1');
       pg_relation_filepath
      ----------------------
      pg_tblspc / 16709 / PG_9.3_201306121 / 16499/19401
      So the filename pattern breaks down to:
      • pg_tblspc: it’s in a non-default tablespace
      • 16709: it’s in the tablespace with oid 16709
      • PG_9.3_201306121: used by PostgreSQL 9.3 with catalog version 201306121.
      • 16499: in the database with oid 16499
      • 19401 the table with relfilenode id 19401

      • Share:
      Nijamutheen J
      Nijamutheen J

      Nijamutheen J 7+ years of experience in PostgreSQL, Linux admin , web hosting - apache server , Oracle ,mySQL, Mriadb, vertica DB & Server security administrator

      My updated resume is https://www.tutorialdba.com/p/hi-i-have-4.html

      Previous post

      Postgresql Partitioned Tables
      January 16, 2019

      Next post

      Moving Database objects or all tables to a different tablespace in PostgreSQL
      January 16, 2019

      Leave A Reply

      You must be logged in to post a comment.

      Connect with



      Search

      ADVERTISEMENT

      Latest Posts

      HOW VIRTUAL OFFICE IS GOING TO CHANGE YOUR BUSINESS STRATEGIES
      21Jun2022
      Take the best advantage of your Virtual Office
      21Jun2022
      Let’s discuss how corporates can improve their productivity through virtual office spaces?
      21Jun2022
      Virtual Office Space & Address Services
      21Jun2022
      HOW VIRTUAL OFFICES ARE TRANSFORMING BUSINESSES
      21Jun2022
      PostgreSQL

      PostgreSQL

      $800.00 $500.00
      Greenplum

      Greenplum

      $1,500.00
      Oracle Database

      Oracle Database

      $350.00
      2ndquadrant.in

      (+91) 8838953252

      ITsupport@rayafeel.com

      Company

      • About Us
      • Our Team

      COURSES

      • List Of Course
      • Become An Instructor

      Support

      • DBA Support
      • Consultancy Services

      Recommend

      • Login
      • Contact Us

      IT Services by rayafeel.com. Powered by Rayafeel Technologies Pvt Ltd.

      • Privacy
      • Terms

      Become An Instructor?

      Join thousand of instructors and earn money hassle free!

      Get Started Now

      Connect with

      Login with Google

      Login with your site account

      Connect with



      Lost your password?