On Wed, 25 Nov 2026 at 16:25, Aidar Imamov <[email protected]> wrote: > > pg_relation_size() and pg_table_size() measure a relation by summing up its > files. That works for heap, but an AM may keep its data elsewhere, and > then the functions report 0 while pg_database_size() sees the files just > fine.
Where does such a hypothetical AM store its data, if not in the files it's designated to use through its relfilenode association? And why would pg_database_size() be guaranteed to know where to look for the relation's data, if pg_relation_size() itself isn't able to find this data? Lastly, why wouldn't CREATE DATABASE ... TEMPLATE break if relation data in the template database isn't stored in the place that PostgreSQL expects it to be stored? Shouldn't that be accomodated, too, if we were to allow table AMs to store their data in nonstandard places? Kind regards, Matthias van de Meent Databricks (https://www.databricks.com)
