PostgreSQL Database Storage Architecture

 PostgreSQL Database Storage Architecture



Page 

Smallest storage unit in PostgreSQL

8 Kb Size 


Page header ( 24 bytes )

ItemIdData ( contain pointer )

Free space

Tuple 

Special




Segment 

Multiple pages collection

Size is 1 G



Toast

When we insert a row, which is bigger than the page size . Automatic handle by PostgreSQL 

Toast data is slower to queries


Questions

How to check number of pages in table ?

How to check number of toast in table ?

How to get table size ?

select pg_column_size(column_name);

How to check Segments ?

How to check Table path ?

select pg_relation_filepath('table_name');



Comments