Check Tablespace and Filespace information in GreenplumDB

Below Post, I am sharing a script to check the Tablespace and Filespace information in GreenplumDB. In Greenplum Database, tablespaces and filespaces are both used for managing storage, but they serve different purposes.

Tablespace:-
Tablespaces In Greenplum are logical storage and used for organizing database objects, example as tables and indexes. Every tablespace is associated with a physical location on the file system where data files are stored.
Greenplum allows us to create tablespaces to manage storage more efficiently,
such as placing different database objects on separate storage devices for performance or administrative purposes.To check information about tablespaces in Greenplum, we can query the pg_tablespace:-

SELECT * FROM pg_tablespace;

Filespaces:

Greenplum Filespaces are logical entities that group together the physical storage locations (directories) where data files are stored. Filespaces are primarily used in the context of external tables, which allow Greenplum to access data stored outside of the database, such as in Hadoop
Distributed File System (HDFS) or on a network file system (NFS).

To get the information about filespaces in Greenplum, we can run the below query:-

SELECT * FROM pg_filespace;


Below query will help us to retrieve information about tablespaces and filespace in Greenplum Database. In Greenplum Database, tablespaces and filespaces are used to manage the storage of data across the segments
of the Greenplum cluster.

SELECT spcname as tblspc ,fsname as filespc ,fsedbid as seg_dbid,fselocation as datadir FROM pg_tablespace pgts ,pg_filespace pgfs ,pg_filespace_entry pgfse WHERE pgts.spcfsoid=pgfse.fsefsoid AND pgfse.fsefsoid=pgfs.oid ORDER BY tblspc, seg_dbid;

Leave a Comment