'size of exported objects with pg_dump

I used pg_dump with the directory format (-d) to export a database containing more than a hundred tables. By comparing the .dat file for a table with its size in the database, I observed that the .dat file is twice larger. How to explain this difference?

-rw-r--r--. 1 postgres postgres 39G May 12 13:36 5247.dat

5247; 0 15391537 TABLE DATA schemaname mytable owner

database=# select pg_size_pretty(pg_table_size('mytable'));
┌────────────────┐
│ pg_size_pretty │
├────────────────┤
│ 20 GB          │
└────────────────┘
(1 row)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source