May 2018
Intermediate to advanced
576 pages
30h 25m
English
The preceding functions, which measure the size of a relation, output the number of bytes, which is normally too large to be immediately clear. You can apply the pg_size_pretty() function to format that number nicely, as shown in the following example:
SELECT pg_size_pretty(pg_relation_size('pgbench_accounts'));
This yields the following output:
pg_size_pretty----------------13 MB(1 row)
TOAST stands for The Oversize Attribute Storage Technique. As the name implies, this is a mechanism used to store long column values. PostgreSQL allows many data types to store values up to 1 GB in size. It transparently stores large data items in many smaller pieces, so the same data type can be used for data ranging from 1 byte to 1 GB. When ...