Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2016 October PostgreSQL: What is TOAST (The Oversized-Attribute Storage Technique)

PostgreSQL: What is TOAST (The Oversized-Attribute Storage Technique)

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

Like SQL Server, PostgreSQL data page size is also 8KB.

This post is very similar to a few of the SQL Server published articles.

SQL Server: The Internal Structure of the Data Page

SQL Server: What happened, when Row Overflow and Data Exceeding 8KB?

PostgreSQL uses 8kb fixed size data page to store tuples of Table.

It does not allow tuples to span in multiple pages because not possible to store large field value directly into the 8kb page.
This is one type of limitation of PostgreSQL.

What is TOAST (The Oversized-Attribute Storage Technique)?

The TOAST is one type of Technique to store and manage oversized or overflow data pages.

This is a background process of PostgreSQL, and It also compresses the value and broken into multiple physical pages.

If row size is exceeding in the main table, It creates new a TOAST table to manage and store oversized rows.

The mechanism is accomplished by splitting up the large column entry into 2KB bytes and storing them as chunks in the TOAST tables.
It then stores the length and a pointer to the TOAST entry back where the column stored.

Because of how the pointer system implemented, most TOAST table column types limited to a max size of 1GB.

The advantage of TOAST table is, whenever data require fetching from TOAST table, only It needs to refer TOAST table otherwise, It does not call unnecessary.

How to find whether a TOAST table is associated with your main tables?

You can easily select reltoastrelid from pg_class. Like any other table ObjectID is also assigned to TOAST Table.

You can execute below script:

1
2
3
SELECT relname,reltoastrelid
FROM pg_class
WHERE relname='Table_Name';

Oct 7, 2016Anvesh Patel
PostgreSQL 9.5: SELECT JSON Formatted data using jsonb_pretty()PostgreSQL: What is a Free Space Map (FSM)?
Comments: 1
  1. cOSME
    January 28, 2020 at 6:26 pm

    cAN YOU EXPLAIN MORE ABOUT IT

Anvesh Patel
Anvesh Patel

Database Engineer

October 7, 2016 PostgreSQL8KB Data Page, Anvesh Patel, database, database research and development, dbrnd, encrypted storage, overflow size, Oversized-Attribute Storage Technique, plpgsql, Postgres Query, postgresql, PostgreSQL Administrator, PostgreSQL Error, PostgreSQL Programming, PostgreSQL Tips and Tricks, Storage, TOAST
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....