Movatterモバイル変換


[0]ホーム

URL:


September 25, 2025: PostgreSQL 18 Released!
Supported Versions:Current (18) /17 /16 /15 /14 /13
Development Versions:devel
Unsupported versions:12 /11 /10 /9.6 /9.5 /9.4 /9.3 /9.2 /9.1 /9.0 /8.4 /8.3
F.27. pg_freespacemap — examine the free space map
Prev UpAppendix F. Additional Supplied Modules and ExtensionsHome Next

F.27. pg_freespacemap — examine the free space map#

Thepg_freespacemap module provides a means for examining thefree space map (FSM). It provides a function calledpg_freespace, or two overloaded functions, to be precise. The functions show the value recorded in the free space map for a given page, or for all pages in the relation.

By default use is restricted to superusers and roles with privileges of thepg_stat_scan_tables role. Access may be granted to others usingGRANT.

The values stored in the free space map are not exact. They're rounded to precision of 1/256th ofBLCKSZ (32 bytes with defaultBLCKSZ), and they're not kept fully up-to-date as tuples are inserted and updated.

For indexes, what is tracked is entirely-unused pages, rather than free space within pages. Therefore, the values are not meaningful, just whether a page is in-use or empty.

postgres=# SELECT * FROM pg_freespace('foo'); blkno | avail-------+-------     0 |     0     1 |     0     2 |     0     3 |    32     4 |   704     5 |   704     6 |   704     7 |  1216     8 |   704     9 |   704    10 |   704    11 |   704    12 |   704    13 |   704    14 |   704    15 |   704    16 |   704    17 |   704    18 |   704    19 |  3648(20 rows)postgres=# SELECT * FROM pg_freespace('foo', 7); pg_freespace--------------         1216(1 row)

F.27.3. Author#

Original version by Mark Kirkwood<markir@paradise.net.nz>. Rewritten in version 8.4 to suit newFSM implementation by Heikki Linnakangas<heikki@enterprisedb.com>


Prev Up Next
F.26. pgcrypto — cryptographic functions Home F.28. pg_logicalinspect — logical decoding components inspection

Submit correction

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please usethis form to report a documentation issue.


[8]ページ先頭

©2009-2025 Movatter.jp