---
title: "A Smaller AI Feature Table Can Keep the Same PostgreSQL File Size"
description: "Leviathan Systems — Technical content Published 2026-10-21; updated 2026-10-21."
canonical: "https://www.leviathansystems.co/articles/ai-postgresql-row-version-space-reuse-file-size"
last-updated: "2026-10-21"
---

# A Smaller AI Feature Table Can Keep the Same PostgreSQL File Size

Leviathan Systems — Technical content
Published 2026-10-21; updated 2026-10-21.

Has a smaller current AI feature population returned storage, or created room for reuse? In PostgreSQL 18, committed deletion can change what a new read sees while older row versions remain needed by another reader. After retention ends and standard vacuuming completes, their space can become reusable within the table without shortening its file. In PG-R8 below, 40 current rows later grow to 70 inside the same 65,536-byte extent. That is a useful reuse outcome; a promise of filesystem space returned or a lower storage bill needs separate evidence.

## Ask what the smaller feature population is meant to achieve

Suppose a fictional AI platform supplier reports that a feature table now contains half as many current rows and describes the result as reclaimed storage. The buyer needs to know what that phrase promises: room for future rows inside this table, a shorter relation file, more space available to the filesystem, or a lower charge.

Those outcomes require different evidence. A row count describes the population visible to a particular read. File length describes an artifact's extent. Reusable space describes where later rows could fit. A price claim adds the provider's charging boundary.

PostgreSQL's MVCC model lets a reader see a database version that differs from the currently updated data. Its storage consequences follow from which row versions remain needed and what cleanup has actually completed. PG-R8 traces that relationship through one fixed example.

References: [PM18](https://www.postgresql.org/docs/18/mvcc-intro.html)

## PG-R8: eight pages, 80 rows and an older reader

PG-R8 is an original hypothetical ordinary heap table, not an observed database or a test result. Stipulate eight existing pages of exactly 8,192 bytes each. The relation-file extent is therefore 8 × 8,192 = 65,536 bytes. Page numbers 1 through 8 describe their order in that file.

Initially there are 80 logical rows. Reader S establishes its snapshot before another transaction commits deletion of 40 rows. S retains that earlier view; ordinary new reads whose snapshots start after the commit see 40 rows. Under the stipulated older snapshot, S still sees 80. There are no unlisted transactions or writes; the later 30-row addition is the only subsequent change.

The 40 retired row versions occupy interior pages 2, 4, 6 and 7. Surviving rows occupy pages 1, 3, 5 and 8. This placement is stipulated, including a live last page; it predicts no real row size or packing density.

The account covers the heap relation's data-file extent. Indexes, TOAST storage, other relation files, WAL, filesystem-block allocation and provider billing are excluded from the arithmetic. The related PostgreSQL snapshot guide explains how a reader's view is selected; here, the two views are fixed so their storage implications can be followed.

References: [PI18](https://www.postgresql.org/docs/18/transaction-iso.html), [PL18](https://www.postgresql.org/docs/18/storage-page-layout.html)

## Forty visible rows do not establish completed cleanup

Immediately after the deletion commits, the new-read population is 40. That does not make the other 40 versions removable while S can still see them. PostgreSQL's storage-recovery documentation explains why updates and deletions preserve old versions that remain potentially visible to other transactions.

The older view is not an additional 80-row copy alongside the 40 current rows. In this example, S can see the surviving 40 and the retired 40; the new reader sees only the surviving 40. Adding the two visible counts would count the survivors twice.

Next stipulate that S ends and every other retention constraint has resolved. The retired versions can now be removed. Eligibility is a changed condition, rather than evidence that the removal work has finished. Finally, stipulate completed standard vacuuming that removes these eligible versions and makes their former tuple areas reusable. Only this last state supplies the reclaimed areas used in the next part of PG-R8.

A supplier's completed-cleanup description should therefore connect the same relation and population to the resolved retention boundary and the resulting reusable space. The earlier 40-row count alone cannot establish that sequence.

References: [PV18](https://www.postgresql.org/docs/18/routine-vacuuming.html)

## The four interior regions become reusable; page 8 keeps the extent

After the stipulated cleanup, pages 2, 4, 6 and 7 offer reclaimed tuple space within the table. Pages 1, 3, 5 and 8 still contain surviving rows. Standard cleanup has not moved those survivors into a new compact file.

The last page remains live. Interior gaps cannot be removed by shortening the end of this file while retaining its existing page positions. The relation therefore still extends through page 8: eight pages and 65,536 bytes. An unchanged length is consistent with the completed cleanup and the smaller current population.

Four pages span 4 × 8,192 = 32,768 bytes of page extent. That is not an exact 32,768-byte allowance for new user data. PostgreSQL pages and rows have headers, item identifiers and other storage overhead. Page area and usable payload are different quantities; this example assigns no exact payload total to the reclaimed regions.

References: [PC18](https://www.postgresql.org/docs/18/sql-vacuum.html), [PL18](https://www.postgresql.org/docs/18/storage-page-layout.html)

## Thirty later rows make reuse a positive result

Now stipulate that 30 new rows fit in the reclaimed areas without extending the relation. This fit is a premise about these particular rows and spaces, rather than a conclusion derived from the four-page count.

The current population becomes 40 + 30 = 70 rows. The relation still has eight pages and a 65,536-byte extent. PG-R8 has supplied room for the stated addition within storage already held by this table.

If that was the buyer's requirement, the unchanged file size is compatible with success. It does not show failed deletion or failed reuse. Conversely, the example supplies no universal rows-per-page ratio, promise that every later 30-row addition fits, or measured growth or performance result.

## A free tail and a rewriting compaction have different implications

Standard vacuuming can return space to the operating system in the special case where one or more pages at the table's end become entirely free and the required exclusive table lock can be obtained. Saying that it never returns space would miss this exception. PG-R8 does not qualify because page 8 remains live.

Full vacuuming uses rewriting compaction: live contents are written into a new compact relation file. The PostgreSQL 18 reference describes exclusive access to the table and temporary space for the new copy while the old copy still exists. A request for a smaller file therefore needs those access and temporary-capacity implications addressed by the appointed database owner.

This comparison explains two possible outcomes. It selects no maintenance method, execution window or authorization for a real database.

References: [PV18](https://www.postgresql.org/docs/18/routine-vacuuming.html), [PC18](https://www.postgresql.org/docs/18/sql-vacuum.html)

## Compare the supplier's account with the outcome being bought

Consider two fictional returns for a buyer who wants room for the same 30-row addition. Offer Count reports 80 rows reduced to 40 and labels half the storage recovered. It leaves the retained-version state, completed cleanup and available fit unexplained. Halving the visible population cannot substantiate halving the relation file or its storage cost.

Offer Reuse reconciles the complete PG-R8 account: S's earlier 80-row view, 40 rows in new reads, retention ending, completed cleanup, reclaimed areas on pages 2, 4, 6 and 7, and the live tail. It then substantiates the stipulated addition reaching 70 current rows within the same 65,536-byte extent. Under this requirement, that is the useful positive answer. Evidence from the actual offered platform would need to establish its corresponding states and fit.

If the buyer instead requires space returned to the filesystem, Offer Reuse answers a narrower question. The supplier must establish the relevant file change and filesystem allocation outcome. If the promise concerns a lower bill, it must also identify the billable quantity and explain how the demonstrated change affects it. Neither the row count nor PG-R8's unchanged extent supplies that pricing evidence.

Keep the next storage layers with their own comparisons. The thin-volume guide distinguishes logical limits from pool backing; the raw/protected-capacity guide follows capacity through protection and client allocation. The SSD garbage-collection guide explains physical reclamation inside flash. Reusable PostgreSQL tuple space establishes none of those downstream states.

## Connect any separate equipment project to its physical scope

If the wider platform project independently needs physical storage or network connections, Leviathan's Structured Cabling & Fiber Installation service and its project inquiry provide a route to discuss agreed fiber and copper installation, endpoint labels and connection records.

Share a nonconfidential equipment and site summary, approved endpoints and routes, material responsibilities and the required physical handoff to discuss scope and availability. Database cleanup, capacity validation and billing reconciliation remain with the appointed database and platform providers.

References: [L1](https://www.leviathansystems.co/services/structured-cabling)

## Primary sources

- [PV18 — PostgreSQL 18: 24.1. Routine Vacuuming](https://www.postgresql.org/docs/18/routine-vacuuming.html). Checked 2026-10-21. Sections 24.1.1–24.1.2 explain retained row versions, later space reuse and the entirely-free-tail exception. Supports the lifecycle distinction in a hypothetical ordinary heap table.
- [PC18 — PostgreSQL 18: VACUUM reference](https://www.postgresql.org/docs/18/sql-vacuum.html). Checked 2026-10-21. Description and the full-rewrite and tail-truncation explanations distinguish reuse within a table from a shorter file, including exclusive locking and temporary-copy space. Used to interpret an offered outcome.
- [PM18 — PostgreSQL 18: 13.1. Concurrency Control Introduction](https://www.postgresql.org/docs/18/mvcc-intro.html). Checked 2026-10-21. Explains MVCC database-version snapshots. Supports distinguishing a reader's view from the currently updated population.
- [PI18 — PostgreSQL 18: 13.2. Transaction Isolation](https://www.postgresql.org/docs/18/transaction-iso.html). Checked 2026-10-21. Sections 13.2.1–13.2.2 describe ordinary new-read snapshots and retained transaction views. PG-R8 stipulates when S's older snapshot is established and retained.
- [PL18 — PostgreSQL 18: 66.6. Database Page Layout](https://www.postgresql.org/docs/18/storage-page-layout.html). Checked 2026-10-21. Describes fixed-size heap pages, page headers, item identifiers and row overhead. PG-R8 stipulates its 8,192-byte page size and layout; page extent is not equated with user payload.
- [L1 — Leviathan Systems: Structured Cabling & Fiber Installation](https://www.leviathansystems.co/services/structured-cabling). Checked 2026-10-21. Defines agreed physical fiber and copper installation, endpoint labels and connection records. Applicable to an equipment-cabling project, with scope and availability confirmed.

## Related Leviathan resources

- [PostgreSQL snapshots: which committed rows a reader sees](/articles/postgresql-statement-snapshot-repeatable-read-input)
- [Thin-volume logical size and shared pool backing](/articles/thin-storage-logical-volume-size-versus-pool-backing)
- [Raw, protected and client-usable storage capacity](/articles/gpu-storage-raw-versus-protected-usable-capacity)
- [SSD garbage collection and physical flash reclamation](/articles/ssd-garbage-collection-versus-fresh-drive-performance)
- [Structured Cabling & Fiber Installation](/services/structured-cabling)
- [Discuss a separately scoped physical cabling project](/contact?service=structured-cabling&from=%2Farticles%2Fai-postgresql-row-version-space-reuse-file-size)

## Does the wider project also need physical cabling?

Share a nonconfidential equipment summary, approved endpoints and routes, material responsibilities and required connection records to discuss a separate installation scope and availability.

[Discuss the scope](/contact?service=structured-cabling&from=/articles/ai-postgresql-row-version-space-reuse-file-size)
