Paste into your AI assistant to fix the article, then ask for a re-review.
Show the text
Fix the article with this report, then ask pgTrue for a re-review.
# pgTrue report: PostgreSQL Index-Only Scans: Why Your Covering Indexes May Be Lying to You
Article title: PostgreSQL Index-Only Scans: Why Your Covering Indexes May Be Lying to You
Article URL: https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that
Report URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d
Audited revision: 4 of 4, 2026-10-21 05:00:45 UTC
Overall letter: B+
## Axes
- Factual: B+ · 1 wrong · 15 checked · 0 caveats · assessed
- Applicable: B · 3 wrong · 6 checked · 0 caveats · assessed
- Consistent: B+ · 1 wrong · 15 checked · 0 caveats · assessed
- Transparent: — · 0 wrong · 1 checked · 1 caveats · assessed
- Safe: A · 0 wrong · 5 checked · 0 caveats · assessed
ElephantSeal: B+.
## Report metadata
- Report: Technical fact-check, edition 3
- Issued: 2026-10-21
- Edition: Updated after review. Corrections are listed below.
- Submitted: Submitted by the PostgresAI team.
- Author response: No written reply from the author. We re-audited this article 3 times; see Revisions below. Policy: [right-of-reply and corrections policy](/pgtrue/security).
- pgTrue version: audited with v1.0.17 (approx.) · regraded with v1.1.1 (approx.)
## Findings needing a change (6)
### F1 · Misleading · Factual · The VM monitoring query references a nonexistent column
Location: excerpt · section “Tuning autovacuum for write-heavy tables” · as fetched 2026-10-21 · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=pg_relation_size%28%20oid%20%29)
Article says:
```text
…pg_relation_size( oid )…
```
What is true:
The VM query fails because pg_stat_user_tables exposes relid, not oid. src/backend/catalog/system_views.sql:681 defines that alias. Lines 749-752 define the user-table view. Replace both oid references with relid.
So what:
Replace both oid references with relid in the VM monitoring query.
Charitable reading:
The example could intend the table’s relation identifier. This view names that identifier relid.
Review: We checked whether oid remained available through SELECT \*. The complete underlying view exposes relid and no oid column. Replacing both references fixes this specific failure. We checked both view definitions for an alternative oid column. They expose relid. Replacing both references fixes this concrete error.
Sources:
- [REL_18_6 · src/backend/catalog/system_views.sql:679-701](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L679-L701)
Excerpt:
```text
CREATE VIEW pg_stat_all_tables AS
SELECT
C.oid AS relid,
N.nspname AS schemaname,
C.relname AS relname,
pg_stat_get_numscans(C.oid) AS seq_scan,
pg_stat_get_lastscan(C.oid) AS last_seq_scan,
pg_stat_get_tuples_returned(C.oid) AS seq_tup_read,
sum(pg_stat_get_numscans(I.indexrelid))::bigint AS idx_scan,
max(pg_stat_get_lastscan(I.indexrelid)) AS last_idx_scan,
sum(pg_stat_get_tuples_fetched(I.indexrelid))::bigint +
pg_stat_get_tuples_fetched(C.oid) AS idx_tup_fetch,
pg_stat_get_tuples_inserted(C.oid) AS n_tup_ins,
pg_stat_get_tuples_updated(C.oid) AS n_tup_upd,
pg_stat_get_tuples_deleted(C.oid) AS n_tup_del,
pg_stat_get_tuples_hot_updated(C.oid) AS n_tup_hot_upd,
pg_stat_get_tuples_newpage_updated(C.oid) AS n_tup_newpage_upd,
pg_stat_get_live_tuples(C.oid) AS n_live_tup,
pg_stat_get_dead_tuples(C.oid) AS n_dead_tup,
pg_stat_get_mod_since_analyze(C.oid) AS n_mod_since_analyze,
pg_stat_get_ins_since_vacuum(C.oid) AS n_ins_since_vacuum,
pg_stat_get_last_vacuum_time(C.oid) as last_vacuum,
pg_stat_get_last_autovacuum_time(C.oid) as last_autovacuum,
```
- [REL_18_6 · src/backend/catalog/system_views.sql:749-752](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L749-L752)
Excerpt:
```text
CREATE VIEW pg_stat_user_tables AS
SELECT * FROM pg_stat_all_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
schemaname !~ '^pg_toast';
```
- [REL_18_6 · src/backend/catalog/system_functions.sql:285-289](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_functions.sql#L285-L289)
Excerpt:
```text
CREATE OR REPLACE FUNCTION pg_relation_size(regclass)
RETURNS bigint
LANGUAGE sql
PARALLEL SAFE STRICT COST 1
RETURN pg_relation_size($1, 'main');
```
- [REL_18_6 · doc/src/sgml/func.sgml:30159-30162](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L30159-L30162)
Excerpt:
```text
or <function>pg_table_size</function>, which sum the sizes of all
forks.) With one argument, this returns the size of the main data
fork of the relation. The second argument can be provided to specify
which fork to examine:
```
- [REL_18_6 · src/backend/catalog/system_views.sql:679-716](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L679-L716)
Excerpt:
```text
CREATE VIEW pg_stat_all_tables AS
SELECT
C.oid AS relid,
```
- [REL_18_6 · src/backend/catalog/system_views.sql:749-752](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L749-L752)
Excerpt:
```text
CREATE VIEW pg_stat_user_tables AS
SELECT * FROM pg_stat_all_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
schemaname !~ '^pg_toast';
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F1
### F2 · Misleading · Consistent · The tuning recommendation misses the insert-trigger parameters
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=High%2Dwrite%20tables%20need%20aggressive%20autovacuum_vacuum_scale_factor%20%281%2D2%25%29)
Article says:
```text
High-write tables need aggressive autovacuum_vacuum_scale_factor (1-2%)…
```
What is true:
Lowering autovacuum_vacuum_scale_factor does not advance insert-triggered vacuums. src/backend/postmaster/autovacuum.c:3122-3127 calculates separate dead-tuple and insert thresholds. Insert-heavy event tables require checking the insert-trigger parameters.
So what:
For insert-heavy tables, tune autovacuum_vacuum_insert_scale_factor and autovacuum_vacuum_insert_threshold instead of relying on the dead-tuple factor.
Charitable reading:
Lowering the dead-tuple factor can help UPDATE-heavy and DELETE-heavy tables. The recommendation also covers insert-heavy event workloads.
Review: We tested the UPDATE-heavy interpretation. That workload benefits from the recommendation, but the article extends it to high-write tables generally. The insert threshold uses separate parameters. We tested the UPDATE-heavy reading. That recommendation works there, but the article also covers inserts. Separate insert thresholds support the caveat.
Sources:
- [REL_18_6 · src/backend/postmaster/autovacuum.c:3122-3127](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L3122-L3127)
Excerpt:
```text
vacthresh = (float4) vac_base_thresh + vac_scale_factor * reltuples;
if (vac_max_thresh >= 0 && vacthresh > (float4) vac_max_thresh)
vacthresh = (float4) vac_max_thresh;
vacinsthresh = (float4) vac_ins_base_thresh +
vac_ins_scale_factor * reltuples * pcnt_unfrozen;
```
- [REL_18_6 · src/backend/postmaster/autovacuum.c:3145-3146](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L3145-L3146)
Excerpt:
```text
*dovacuum = force_vacuum || (vactuples > vacthresh) ||
(vac_ins_base_thresh >= 0 && instuples > vacinsthresh);
```
- [REL_18_6 · doc/src/sgml/config.sgml:9131-9134](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L9131-L9134)
Excerpt:
```text
Specifies a fraction of the table size to add to
<varname>autovacuum_vacuum_threshold</varname>
when deciding whether to trigger a <command>VACUUM</command>.
The default is <literal>0.2</literal> (20% of table size).
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F2
### F3 · Misleading · Applicable · Faster execution after VACUUM ANALYZE does not isolate VM coverage
Location: excerpt · section “When to force a VACUUM” · as fetched 2026-10-21 · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=if%20query%20latency%20drops%20significantly,just%20confirmed%20the%20real%20bottleneck)
Article says:
```text
…if query latency drops significantly after a manual VACUUM, you’ve just confirmed the real bottleneck…
```
What is true:
Faster execution after VACUUM ANALYZE does not identify VM coverage as the cause. src/backend/commands/vacuum.c:666 also runs ANALYZE. That updates planner statistics. Compare plans and heap-fetch counts before changing autovacuum.
So what:
Compare execution plans and Heap Fetches before and after maintenance. Separate ANALYZE effects before changing autovacuum settings.
Charitable reading:
A latency improvement can support further investigation. It cannot identify VM coverage as the cause by itself.
Review: We considered latency improvement as supporting evidence. The article claims confirmation, while its VACUUM ANALYZE command also changes planner statistics. The diagnosis does not isolate visibility coverage. We checked whether the proposed maintenance isolates visibility changes. Its ANALYZE option also updates planner statistics. Latency alone cannot identify the cause.
Sources:
- [REL_18_6 · doc/src/sgml/ref/vacuum.sgml:142-143](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/vacuum.sgml#L142-L143)
Excerpt:
```text
Updates statistics used by the planner to determine the most
efficient way to execute a query.
```
- [REL_18_6 · src/backend/commands/vacuum.c:666-667](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/vacuum.c#L666-L667)
Excerpt:
```text
analyze_rel(vrel->oid, vrel->relation, params,
vrel->va_cols, in_outer_xact, bstrategy);
```
- [REL_18_6 · doc/src/sgml/ref/vacuum.sgml:519-519](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/vacuum.sgml#L519-L519)
Excerpt:
```text
VACUUM (VERBOSE, ANALYZE) onek;
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F3
### F4 · Misleading · Applicable · Table-wide VM coverage does not determine a query’s heap fetches
Location: excerpt · section “Tuning autovacuum for write-heavy tables” · as fetched 2026-10-21 · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=If%20vm_visible_pages%20is%20significantly%20less,are%20paying%20for%20heap%20fetches)
Article says:
```text
…If vm_visible_pages is significantly less than heap_pages , your index-only scans are paying for heap fetches…
```
What is true:
A table-wide VM ratio does not determine heap fetches for a particular query. src/backend/executor/nodeIndexonlyscan.c:162-170 tests each candidate’s heap page. A query restricted to all-visible pages can fetch zero heap tuples despite low table coverage.
So what:
Use EXPLAIN ANALYZE on the affected query before scheduling vacuum work from the table-wide VM ratio.
Charitable reading:
Low table-wide coverage can increase heap fetches. The stated condition does not establish which pages a query visits.
Review: We tested whether low table coverage necessarily implies heap fetches. The executor checks each candidate page. Queries confined to all-visible pages provide a counterexample. We tested whether low global coverage forces heap fetches. The executor checks each candidate page. Queries confined to all-visible pages provide a counterexample.
Sources:
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F4
### F5 · Misleading · Applicable · Misleading: “…SELECT count ( \* ) FROM pg_visibility( oid ) WHERE all_visible…”
Location: excerpt · section “Tuning autovacuum for write-heavy tables” · as fetched 2026-10-21 · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=SELECT%20count%20%28%20%2A%20%29,pg_visibility%28%20oid%20%29%20WHERE%20all_visible)
Article says:
```text
…SELECT count ( * ) FROM pg_visibility( oid ) WHERE all_visible…
```
What is true:
After replacing oid with relid, the monitoring query reads every heap block. contrib/pg_visibility/pg_visibility.c:238 requests page-header data. Lines 559-577 read those blocks. Use pg_visibility_map_summary(relid) for routine coverage polling. The printed query itself fails before these reads.
So what:
Use pg_visibility_map_summary(relid) for routine all-visible page counts instead of counting rows from pg_visibility(relid).
Review: The printed query fails before reading heap blocks because oid does not exist. After correcting that column, pg_visibility requests page-header inspection. The performance finding survives conditionally. The displayed query fails before reading heap blocks. The full-table reading cost applies after correcting oid to relid.
Sources:
- [REL_18_6 · src/backend/catalog/system_views.sql:679-701](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L679-L701)
Excerpt:
```text
CREATE VIEW pg_stat_all_tables AS
SELECT
C.oid AS relid,
N.nspname AS schemaname,
C.relname AS relname,
pg_stat_get_numscans(C.oid) AS seq_scan,
pg_stat_get_lastscan(C.oid) AS last_seq_scan,
pg_stat_get_tuples_returned(C.oid) AS seq_tup_read,
sum(pg_stat_get_numscans(I.indexrelid))::bigint AS idx_scan,
max(pg_stat_get_lastscan(I.indexrelid)) AS last_idx_scan,
sum(pg_stat_get_tuples_fetched(I.indexrelid))::bigint +
pg_stat_get_tuples_fetched(C.oid) AS idx_tup_fetch,
pg_stat_get_tuples_inserted(C.oid) AS n_tup_ins,
pg_stat_get_tuples_updated(C.oid) AS n_tup_upd,
pg_stat_get_tuples_deleted(C.oid) AS n_tup_del,
pg_stat_get_tuples_hot_updated(C.oid) AS n_tup_hot_upd,
pg_stat_get_tuples_newpage_updated(C.oid) AS n_tup_newpage_upd,
pg_stat_get_live_tuples(C.oid) AS n_live_tup,
pg_stat_get_dead_tuples(C.oid) AS n_dead_tup,
pg_stat_get_mod_since_analyze(C.oid) AS n_mod_since_analyze,
pg_stat_get_ins_since_vacuum(C.oid) AS n_ins_since_vacuum,
pg_stat_get_last_vacuum_time(C.oid) as last_vacuum,
pg_stat_get_last_autovacuum_time(C.oid) as last_autovacuum,
```
- [REL_18_6 · src/backend/catalog/system_views.sql:749-752](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L749-L752)
Excerpt:
```text
CREATE VIEW pg_stat_user_tables AS
SELECT * FROM pg_stat_all_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
schemaname !~ '^pg_toast';
```
- [REL_18_6 · contrib/pg_visibility/pg_visibility.c:238-238](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pg_visibility/pg_visibility.c#L238-L238)
Excerpt:
```text
funcctx->user_fctx = collect_visibility_data(relid, true);
```
- [REL_18_6 · contrib/pg_visibility/pg_visibility.c:559-577](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pg_visibility/pg_visibility.c#L559-L577)
Excerpt:
```text
* Page-level data requires reading every block, so only get it if the
* caller needs it. Use a buffer access strategy, too, to prevent
* cache-trashing.
*/
if (include_pd)
{
Buffer buffer;
Page page;
buffer = read_stream_next_buffer(stream, NULL);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
page = BufferGetPage(buffer);
if (PageIsAllVisible(page))
info->bits[blkno] |= (1 << 2);
UnlockReleaseBuffer(buffer);
}
}
```
- [REL_18_6 · doc/src/sgml/pgvisibility.sgml:96-98](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/pgvisibility.sgml#L96-L98)
Excerpt:
```text
Returns the number of all-visible pages and the number of all-frozen
pages in the relation according to the visibility map.
</para>
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F5
### F16 · Unsupported · Transparent · Write throughput alone does not establish the table's heap-fetch percentages
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=100%E2%80%93500%20rows%2Fsec%20Marginally%2010%E2%80%9340%25%20%3E,Bulk%20ingest%20%28ETL%29%20No%20100%25)
Article says:
```text
…100–500 rows/sec Marginally 10–40% > 500 rows/sec No 60–100% Bulk ingest (ETL) No 100%…
```
What is true:
Rows/sec alone does not determine heap-fetch percentages. autovacuum.c:3122 computes thresholds from table size and tuple counts. nodeIndexonlyscan.c:162 checks each referenced page. The article supplies no workload or measurement basis for its 100/500 rows/sec bands. Those bands cannot establish another table's expected heap-fetch rate.
So what:
Measure Heap Fetches and page visibility on the target workload before tuning autovacuum from the 100/500 rows/sec bands.
Charitable reading:
The percentages could summarize an unstated workload. The article presents them as typical across write-throughput bands without defining that workload.
Review: We considered the percentages as observations from one workload. The article supplies no workload definition. The finding challenges their general applicability without claiming those percentages cannot occur. We tested whether the percentages could describe one workload. They could, but the article supplies none. The finding rejects generalization, not possible measurements.
Sources:
- [REL_18_6 · src/backend/postmaster/autovacuum.c:3122-3127](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L3122-L3127)
Excerpt:
```text
vacthresh = (float4) vac_base_thresh + vac_scale_factor * reltuples;
if (vac_max_thresh >= 0 && vacthresh > (float4) vac_max_thresh)
vacthresh = (float4) vac_max_thresh;
vacinsthresh = (float4) vac_ins_base_thresh +
vac_ins_scale_factor * reltuples * pcnt_unfrozen;
```
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F16
## Verified accurate claims (9)
### F8 · Accurate · Factual · Index-only scans use each candidate page’s all-visible bit
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=Only%20when%20the%20VM%20bit,skip%20the%20heap%20fetch%20entirely.)
Article says:
```text
Only when the VM bit is set can an index-only scan skip the heap fetch entirely.
```
What is true:
Index-only scans test each candidate page’s all-visible bit before fetching the heap. src/backend/executor/nodeIndexonlyscan.c:162-171 implements that test. Heap headers store transaction IDs. Index entries reference heap tuples. VACUUM sets eligible VM bits. A covering index includes the query’s required columns.
Charitable reading:
The passage describes the all-visible bit used by index-only scans.
Review: We checked the executor branch, tuple headers, and vacuum bit-setting path. They support the conditional heap-avoidance explanation and the covering-index definition. We checked the executor condition, tuple headers, and VACUUM implementation. They support the conditional heap-avoidance explanation.
Sources:
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
- [REL_18_6 · src/backend/access/heap/vacuumlazy.c:2924-2939](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/vacuumlazy.c#L2924-L2939)
Excerpt:
```text
if (heap_page_is_all_visible(vacrel, buffer, &visibility_cutoff_xid,
&all_frozen))
{
uint8 flags = VISIBILITYMAP_ALL_VISIBLE;
if (all_frozen)
{
Assert(!TransactionIdIsValid(visibility_cutoff_xid));
flags |= VISIBILITYMAP_ALL_FROZEN;
}
PageSetAllVisible(page);
visibilitymap_set(vacrel->rel, blkno, buffer,
InvalidXLogRecPtr,
vmbuffer, visibility_cutoff_xid,
flags);
```
- [REL_18_6 · doc/src/sgml/storage.sgml:669-672](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/storage.sgml#L669-L672)
Excerpt:
```text
The map is conservative in the sense that we make sure that whenever a bit is
set, we know the condition is true, but if a bit is not set, it might or
might not be true. Visibility map bits are only set by vacuum, but are
cleared by any data-modifying operations on a page.
```
- [REL_18_6 · doc/src/sgml/indices.sgml:1213-1215](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/indices.sgml#L1213-L1215)
Excerpt:
```text
a table's heap, whether all rows stored in that page are old enough to be
visible to all current and future transactions. This information is
stored in a bit in the table's <firstterm>visibility map</firstterm>. An
```
- [REL_18_6 · doc/src/sgml/indices.sgml:1241-1244](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/indices.sgml#L1241-L1244)
Excerpt:
```text
To make effective use of the index-only scan feature, you might choose to
create a <firstterm>covering index</firstterm>, which is an index
specifically designed to include the columns needed by a particular
type of query that you run frequently. Since queries typically need to
```
- [REL_18_6 · src/backend/postmaster/autovacuum.c:3196-3196](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L3196-L3196)
Excerpt:
```text
vacuum(rel_list, &tab->at_params, bstrategy, vac_context, true);
```
- [REL_18_6 · src/include/access/htup_details.h:122-125](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/access/htup_details.h#L122-L125)
Excerpt:
```text
typedef struct HeapTupleFields
{
TransactionId t_xmin; /* inserting xact ID */
TransactionId t_xmax; /* deleting or locking xact ID */
```
- [REL_18_6 · src/include/access/itup.h:35-37](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/access/itup.h#L35-L37)
Excerpt:
```text
typedef struct IndexTupleData
{
ItemPointerData t_tid; /* reference TID to heap tuple */
```
- [REL_18_6 · doc/src/sgml/ref/vacuum.sgml:519-519](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/vacuum.sgml#L519-L519)
Excerpt:
```text
VACUUM (VERBOSE, ANALYZE) onek;
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F8
### F9 · Accurate · Factual · The cost-delay setting uses milliseconds and defaults to 2
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=autovacuum_vacuum_cost_delay%20%3D%202)
Article says:
```text
…autovacuum_vacuum_cost_delay = 2…
```
What is true:
The base cost-delay setting defaults to 2 milliseconds. doc/src/sgml/config.sgml:9275-9279 defines its units. src/backend/postmaster/autovacuum.c:1658-1664 gives table settings precedence over global settings.
Charitable reading:
The comment describes the base cost delay, rather than elapsed time between successive limit hits.
Review: We checked units, default, and override precedence. The finding correctly describes a base delay rather than promising a fixed interval between cost-limit hits. We checked units, default, and override precedence. The finding correctly limits its statement to the base delay.
Sources:
- [REL_18_6 · doc/src/sgml/config.sgml:9275-9279](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L9275-L9279)
Excerpt:
```text
Specifies the cost delay value that will be used in automatic
<command>VACUUM</command> operations. If -1 is specified, the regular
<xref linkend="guc-vacuum-cost-delay"/> value will be used.
If this value is specified without units, it is taken as milliseconds.
The default value is 2 milliseconds.
```
- [REL_18_6 · src/backend/postmaster/autovacuum.c:1658-1664](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L1658-L1664)
Excerpt:
```text
if (av_storage_param_cost_delay >= 0)
vacuum_cost_delay = av_storage_param_cost_delay;
else if (autovacuum_vac_cost_delay >= 0)
vacuum_cost_delay = autovacuum_vac_cost_delay;
else
/* fall back to VacuumCostDelay */
vacuum_cost_delay = VacuumCostDelay;
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F9
### F10 · Accurate · Factual · Verified accurate: “…autovacuum_vacuum_cost_limit = 800…”
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=autovacuum_vacuum_cost_limit%20%3D%20800)
Article says:
```text
…autovacuum_vacuum_cost_limit = 800…
```
What is true:
A table cost limit of 800 overrides the inherited worker limit. src/backend/postmaster/autovacuum.c:1733-1734 assigns it directly. The global parameter defaults to -1 and inherits vacuum_cost_limit. That parameter defaults to 200 cost units.
Review: E-26 assigns the cost limit. It does not establish delay-check timing or exactly 800 cost units between checks. We tested the apparent conflict between defaults -1 and 200. The former inherits the latter. The table override directly supplies 800 cost units.
Sources:
- [REL_18_6 · src/backend/postmaster/autovacuum.c:1733-1734](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L1733-L1734)
Excerpt:
```text
if (av_storage_param_cost_limit > 0)
vacuum_cost_limit = av_storage_param_cost_limit;
```
- [REL_18_6 · doc/src/sgml/config.sgml:9297-9300](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L9297-L9300)
Excerpt:
```text
Specifies the cost limit value that will be used in automatic
<command>VACUUM</command> operations. If <literal>-1</literal>
is specified (which is the default), the regular
<xref linkend="guc-vacuum-cost-limit"/> value will be used. Note that
```
- [REL_18_6 · src/backend/utils/misc/guc_tables.c:2678-2679](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc_tables.c#L2678-L2679)
Excerpt:
```text
&VacuumCostLimit,
200, 1, 10000,
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F10
### F12 · Accurate · Factual · EXPLAIN ANALYZE exposes index-only heap-fetch attempts
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=EXPLAIN%20%28ANALYZE%2C%20BUFFERS%29)
Article says:
```text
EXPLAIN (ANALYZE, BUFFERS)…
```
What is true:
EXPLAIN ANALYZE reports heap-fetch attempts for index-only scans. src/backend/commands/explain.c:1982-1984 prints the counter incremented by src/backend/executor/nodeIndexonlyscan.c:169. The node label alone does not establish heap avoidance.
Charitable reading:
The command provides the claimed diagnostic counter. It does not authenticate the example’s displayed measurements.
Review: We checked whether Heap Fetches counts successful rows or attempts. The increment precedes the visibility result, and EXPLAIN prints that counter. We traced the printed counter to its executor increment. The finding verifies counter semantics without authenticating the example measurements.
Sources:
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
- [REL_18_6 · src/backend/commands/explain.c:1982-1984](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/explain.c#L1982-L1984)
Excerpt:
```text
if (es->analyze)
ExplainPropertyFloat("Heap Fetches", NULL,
planstate->instrument->ntuples2, 0, es);
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F12
### F13 · Accurate · Factual · EXPLAIN ANALYZE exposes index-only scan heap fallbacks
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=diagnose%20heap%20fetch%20fallbacks%20with%20EXPLAIN%20ANALYZE)
Article says:
```text
…diagnose heap fetch fallbacks with EXPLAIN ANALYZE…
```
What is true:
EXPLAIN ANALYZE reports Heap Fetches for an Index Only Scan. src/backend/commands/explain.c:1982 prints ntuples2. src/backend/executor/nodeIndexonlyscan.c:169 increments that counter when the executor must check heap visibility.
Charitable reading:
The diagnostic recommendation concerns the Heap Fetches counter rather than independent verification of the displayed measurements.
Review: We traced ntuples2 from increment to EXPLAIN output. The diagnostic claim holds, although F12 already verifies the same mechanism. We independently matched the executor counter and EXPLAIN output. The verified behavior duplicates F12 but remains correct.
Sources:
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
- [REL_18_6 · src/backend/commands/explain.c:1975-1988](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/explain.c#L1975-L1988)
Excerpt:
```text
if (es->analyze)
ExplainPropertyFloat("Heap Fetches", NULL,
planstate->instrument->ntuples2, 0, es);
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F13
### F14 · Accurate · Factual · Covering an index does not guarantee heap avoidance
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=conditional%20nature%20of%20that%20promise)
Article says:
```text
…conditional nature of that promise…
```
What is true:
Index coverage does not establish tuple visibility. doc/src/sgml/indices.sgml:1205 describes the MVCC requirement. src/backend/executor/nodeIndexonlyscan.c:162 checks the candidate page's all-visible status. The executor fetches the heap when that check fails.
Charitable reading:
The article introduces unconditional heap avoidance as a misconception and immediately states the visibility condition.
Review: We read the preceding unconditional statement in context. The article introduces a misconception and then supplies the visibility condition. The finding correctly credits that explanation. We read the surrounding misconception and correction together. The article states the visibility condition, which both documentation and executor support.
Sources:
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
- [REL_18_6 · doc/src/sgml/indices.sgml:1202-1223](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/indices.sgml#L1202-L1223)
Excerpt:
```text
table scan in <productname>PostgreSQL</productname>: it must verify that
each retrieved row be <quote>visible</quote> to the query's MVCC
snapshot, as discussed in <xref linkend="mvcc"/>. Visibility information
is not stored in index entries, only in heap entries; so at first glance
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F14
### F15 · Accurate · Factual · Manual VACUUM does not preserve visibility coverage through later writes
Location: excerpt · section “When to force a VACUUM” · as fetched 2026-10-21 · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=This%20isn%E2%80%99t%20a%20permanent%20fix.)
Article says:
```text
…This isn’t a permanent fix.
```
What is true:
VACUUM can restore all-visible status, but later writes can clear it. src/backend/access/heap/vacuumlazy.c:99 describes setting visibility bits. src/backend/access/heap/heapam.c:2146 clears visibility state during insertion. Manual VACUUM provides no permanent guarantee for a changing table.
Charitable reading:
The statement concerns a table that receives further writes after manual VACUUM.
Review: We tested an unchanged table as a counterexample. The finding explicitly concerns later writes, whose insertion path can clear visibility bits. It makes no claim about unchanged tables. We tested the static-table exception. The finding explicitly concerns later writes. The insertion path can clear visibility state after VACUUM.
Sources:
- [REL_18_6 · src/backend/access/heap/heapam.c:2138-2157](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L2138-L2157)
Excerpt:
```text
if (clear_all_visible)
{
/* It's possible the VM bits were already clear */
if (visibilitymap_clear_locked(relation,
```
- [REL_18_6 · src/backend/access/heap/vacuumlazy.c:95-103](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/vacuumlazy.c#L95-L103)
Excerpt:
```text
* After pruning and freezing, pages that are newly all-visible and all-frozen
* are marked as such in the visibility map.
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F15
### F18 · Accurate · Factual · Zero Heap Fetches means no heap visibility fetches
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=Heap%20Fetches%3A%200)
Article says:
```text
…Heap Fetches: 0…
```
What is true:
Heap Fetches: 0 means this index-only scan made no heap visibility fetches. explain.c:1983 prints the ntuples2 counter. nodeIndexonlyscan.c:169 increments that counter before each heap visibility fetch.
Charitable reading:
The example illustrates the Heap Fetches counter's meaning. It does not establish that every vacuumed table produces zero.
Review: We checked whether zero describes table-wide coverage or this scan's counter. The finding limits its conclusion to heap visibility fetches by this scan. We checked whether zero counts physical reads or visibility-fetch attempts. The executor and output code support the latter interpretation.
Sources:
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
- [REL_18_6 · src/backend/commands/explain.c:1977-1987](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/explain.c#L1977-L1987)
Excerpt:
```text
if (es->analyze)
ExplainPropertyFloat("Heap Fetches", NULL,
planstate->instrument->ntuples2, 0, es);
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F18
### F20 · Accurate · Factual · The heap-fetch and returned-row counts can coexist
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=%28actual%20time%3D0.341..1.204%20rows%3D50%29%20Heap%20Fetches%3A%202847)
Article says:
```text
…(actual time=0.341..1.204 rows=50) Heap Fetches: 2847…
```
What is true:
The 2,847 heap-fetch attempts can produce 50 visible rows. nodeIndexonlyscan.c:169 counts attempts before visibility succeeds. Repeated attempts can reuse a pinned heap buffer. bufmgr.c:3055 returns that buffer without ReadBuffer. The 510 buffer accesses do not contradict 2,847 attempts.
Charitable reading:
The examples describe different visibility states for mobile_events and idx_events_covering. Their differing counters do not contradict each other.
Review: We checked the 510 buffer accesses against 2,847 attempts and 50 returned rows. Failed visibility checks and buffer reuse permit these counts. This establishes compatibility, not measurement authenticity. We checked 312 hits plus 198 reads against 2,847 attempts. Buffer reuse permits fewer accesses. Failed visibility checks permit only 50 returned rows.
Sources:
- [REL_18_6 · src/backend/executor/nodeIndexonlyscan.c:162-171](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeIndexonlyscan.c#L162-L171)
Excerpt:
```text
if (!VM_ALL_VISIBLE(scandesc->heapRelation,
ItemPointerGetBlockNumber(tid),
&node->ioss_VMBuffer))
{
/*
* Rats, we have to visit the heap to check visibility.
*/
InstrCountTuples2(node, 1);
if (!index_fetch_heap(scandesc, node->ioss_TableSlot))
continue; /* no visible tuple, try next index entry */
```
- [REL_18_6 · src/backend/access/heap/heapam_handler.c:100-160](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam_handler.c#L100-L160)
Excerpt:
```text
hscan->xs_cbuf = ReleaseAndReadBuffer(hscan->xs_cbuf,
hscan->xs_base.rel,
ItemPointerGetBlockNumber(tid));
```
- [REL_18_6 · src/backend/storage/buffer/bufmgr.c:3032-3065](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/buffer/bufmgr.c#L3032-L3065)
Excerpt:
```text
if (bufHdr->tag.blockNum == blockNum &&
BufTagMatchesRelFileLocator(&bufHdr->tag, &relation->rd_locator) &&
BufTagGetForkNum(&bufHdr->tag) == forkNum)
return buffer;
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F20
## Notes (not graded) (3)
### F6 · Note · · The VM stores two bits per heap page
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=one%2Dbit%2Dper%2Dpage%20structure)
Article says:
```text
…one-bit-per-page structure…
```
What is true:
The VM has 2 bits per heap page. doc/src/sgml/storage.sgml:658-664 names the all-visible and all-frozen bits. Index-only scans use the all-visible bit.
Charitable reading:
One all-visible bit per page controls index-only heap avoidance. The complete VM contains another bit.
Explanation: Not graded: knowing this would not change what a reader does.
Review: We considered one bit as shorthand for the all-visible component. The complete map stores two bits. The existing note classification preserves that charitable reading without grading a cosmetic distinction. We tested the charitable interpretation of one all-visible bit. The full map has two bits. Note severity preserves that operational distinction.
Sources:
- [REL_18_6 · doc/src/sgml/storage.sgml:658-664](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/storage.sgml#L658-L664)
Excerpt:
```text
The visibility map stores two bits per heap page. The first bit, if set,
indicates that the page is all-visible, or in other words that the page does
not contain any tuples that need to be vacuumed.
This information can also be used
by <link linkend="indexes-index-only-scans"><firstterm>index-only
scans</firstterm></link> to answer queries using only the index tuple.
The second bit, if set, means that all tuples on the page have been frozen.
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F6
### F7 · Note · · A 0.01 scale factor is not an exact 1% trigger
Location: Article · exact quote · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=trigger%20at%201%25%20dead%20tuples)
Article says:
```text
…trigger at 1% dead tuples…
```
What is true:
A scale factor of 0.01 is not an exact 1% trigger. src/backend/postmaster/autovacuum.c:3122-3124 adds the base threshold and applies the maximum threshold. The factor’s default is 0.2.
Charitable reading:
For large tables, the base threshold can be small relative to the scale-factor term.
Explanation: Not graded: knowing this would not change what a reader does.
Review: We tested the large-table approximation. It explains the comment but does not remove the additive threshold or maximum. A note appropriately preserves this distinction. We checked the large-table approximation. The base threshold and maximum still prevent an exact universal 1% trigger. Note severity fits.
Sources:
- [REL_18_6 · src/backend/postmaster/autovacuum.c:3122-3127](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L3122-L3127)
Excerpt:
```text
vacthresh = (float4) vac_base_thresh + vac_scale_factor * reltuples;
if (vac_max_thresh >= 0 && vacthresh > (float4) vac_max_thresh)
vacthresh = (float4) vac_max_thresh;
vacinsthresh = (float4) vac_ins_base_thresh +
vac_ins_scale_factor * reltuples * pcnt_unfrozen;
```
- [REL_18_6 · src/backend/postmaster/autovacuum.c:3145-3146](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/postmaster/autovacuum.c#L3145-L3146)
Excerpt:
```text
*dovacuum = force_vacuum || (vactuples > vacthresh) ||
(vac_ins_base_thresh >= 0 && instuples > vacinsthresh);
```
- [REL_18_6 · doc/src/sgml/config.sgml:9131-9134](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L9131-L9134)
Excerpt:
```text
Specifies a fraction of the table size to add to
<varname>autovacuum_vacuum_threshold</varname>
when deciding whether to trigger a <command>VACUUM</command>.
The default is <literal>0.2</literal> (20% of table size).
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F7
### F19 · Note · · The page-count divisor assumes 8 KiB heap pages
Location: excerpt · section “Tuning autovacuum for write-heavy tables” · as fetched 2026-10-21 · [open in article](https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that#:~:text=%28pg_relation_size%28%20oid%20%29%20%2F%208192%20%29%3A%3A%20int%20AS%20heap_pages)
Article says:
```text
…(pg_relation_size( oid ) / 8192 ):: int AS heap_pages…
```
What is true:
The 8,192-byte divisor matches default PostgreSQL builds. configure.ac:255 selects 8 KiB by default. Lines 257–262 also permit other page sizes. Use the server's block_size setting when the monitoring query must support those builds.
So what:
Use current_setting('block_size')::bigint as the divisor when supporting nondefault PostgreSQL builds.
Charitable reading:
The 8,192-byte divisor matches PostgreSQL's default build configuration.
Explanation: Not graded: no reader would act differently on it.
Review: We checked whether 8 KiB is mandatory or merely the default. configure.ac permits six block sizes. The note correctly accepts the default-build arithmetic. We checked the default and permitted build sizes. The 8,192-byte divisor matches the default. Note severity correctly treats other sizes as portability.
Sources:
- [REL_18_6 · src/backend/catalog/system_views.sql:668-710](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L668-L710)
Excerpt:
```text
C.oid AS relid,
```
- [REL_18_6 · src/backend/catalog/system_views.sql:749-752](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L749-L752)
Excerpt:
```text
CREATE VIEW pg_stat_user_tables AS
SELECT * FROM pg_stat_all_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema') AND
schemaname !~ '^pg_toast';
```
- [REL_18_6 · configure.ac:249-265](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/configure.ac#L249-L265)
Excerpt:
```text
[blocksize=8])
case ${blocksize} in
1) BLCKSZ=1024;;
2) BLCKSZ=2048;;
4) BLCKSZ=4096;;
8) BLCKSZ=8192;;
16) BLCKSZ=16384;;
32) BLCKSZ=32768;;
```
Finding URL: https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d#F19
## Withdrawn findings (0)
None.
## Section checks
- Introduction · A · 1 verified-accurate · 100% of claims (7 of 7, plus 1 that need data we do not have)
- Scan mechanics · A · 1 verified-accurate · 100% of claims (12 of 12)
- Heap fetch diagnostics · A · 4 verified-accurate · 100% of claims (4 of 4, plus 11 that need data we do not have)
- Write pressure · A · 1 imprecise · 100% of claims (6 of 6)
- Autovacuum tuning · A · 2 verified-accurate · 100% of claims (10 of 10, plus 1 that need data we do not have)
- Visibility monitoring · B · 3 misleading · 100% of claims (14 of 14)
- Manual vacuum · B+ · 1 misleading · 1 verified-accurate · 100% of claims (6 of 6)
- Operational recommendations · B+ · 1 misleading · 100% of claims (5 of 5, plus 1 that need data we do not have)
## Claim coverage
- Introduction: 7 of 7 Postgres claims checked, plus 1 that need data we do not have; not counted: 5 not a claim
- Scan mechanics: 12 of 12 Postgres claims checked; not counted: 1 not a claim
- Heap fetch diagnostics: 4 of 4 Postgres claims checked, plus 11 that need data we do not have; not counted: 2 product or opinion, 2 duplicate, 1 not a claim
- Write pressure: 6 of 6 Postgres claims checked; not counted: 1 product or opinion, 2 duplicate, 1 not a claim
- Autovacuum tuning: 10 of 10 Postgres claims checked, plus 1 that need data we do not have; not counted: 1 product or opinion, 1 not a claim
- Visibility monitoring: 14 of 14 Postgres claims checked
- Manual vacuum: 6 of 6 Postgres claims checked; not counted: 1 product or opinion, 1 not a claim
- Operational recommendations: 5 of 5 Postgres claims checked, plus 1 that need data we do not have; not counted: 2 product or opinion, 4 duplicate, 3 not a claim
## What we did not check
- We did not verify the mobile_events schema or the definition of idx_events_covering.
- We did not reproduce the displayed execution statistics or verify the table’s write-rate ranges.
- We did not verify the original formatting of the ALTER TABLE example.
- We could not determine which PostgreSQL release produced the examples.
- We did not reproduce the execution plans or latency measurements the article displays.
- We did not verify the claim that global autovacuum defaults necessarily fail at scale.
- We could not reach the article's Twitter and LinkedIn sharing links.
- We did not reproduce the EXPLAIN timings, costs, row counts, heap-fetch counts, or buffer counts.
- We did not verify the workload measurements behind the write-throughput table.
- We could not decide whether the article contains a material benchmark.
## Notes
- B+ — the findings address the article's main subject. What we did not check is listed below. The findings directly check Index Only Scan visibility, Heap Fetches diagnostics, monitoring SQL, and autovacuum settings.
- We did not check everything in this article. What we did not check is listed below, in the words we recorded at the time. None of it moved the letter. We never charge our own limits to the article.
- Average of 4 axes: 3.4 · result B+
- Some explanatory text is not shown in this edition; the grade and findings are complete.
- Some checks did not happen for this edition, and each one we know of is listed above.
- Checked against: github.com/postgres/postgres REL_18_6 at commit 724edf9bde9d356724ad384a2e196edc3c9f80f7 (pinned target).
- Article captured 2026-10-21T05:00:45.893935Z · SHA-256 10f5b2d9a08147dae47180ef14ace190f2c820a54a987ae723b485e82b5cf0b9 · Text extracted from the article's HTML.
- Policy SHA-256 b51313ade6ce874865cdef3dfd8e48e73485009a023705fd042be9574ef11ce2 · Grading rules SHA-256 6fb334e79d6b9e7ed81d3238cc10d9de602ff87ed65ff2fa781f53bac5798765.
- We checked PostgreSQL REL_18_6. The article does not identify its PostgreSQL release.
- We did not reproduce the displayed plans, timings, row counts, heap-fetch counts, or buffer counts.
- We did not verify the mobile_events schema or the idx_events_covering definition.
- We did not verify the workload measurements behind the write-throughput table.
- We did not verify the original formatting of the ALTER TABLE example.
- We did not verify that global autovacuum defaults necessarily fail at scale.
- We could not reach the article's Twitter and LinkedIn sharing links.
- The article gives August 18, 2026, without a time. We list that date at midnight UTC.
- review: the findings were written by one model and reviewed independently by a different model.
- 2026-10-29: Regraded under the current grading rules: the letter is the average of the axis letters, with every cap stated under it.
- 4 passages in this edition fell short of our own plain-English rules.
- Built from the article text captured above and one pinned source tree.
- 16 survived · 2 weakened · 0 withdrawn.
## Revision history
- [Revision 1](https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d?v=46) · 2026-09-09 05:12 UTC · C+ · audit version not recorded · regrade version not recorded
Article as first submitted. 3 accurate · 4 wrong · 12 caveats.
ElephantSeal: C+.
Changes: First audit. Open: F8 “…(pg_relation_size( oid ) / 8192 ):: int AS heap_pages…” (false); F13 “…100–500 rows/sec Marginally 10–40%…” (misleading); F15 “…Bulk ingest (ETL) No 100%…” (misleading); F19 “…100–500 rows/sec Marginally 10–40% \> 500 rows/sec No 60–100%…” (misleading); F1 “…a compact, one-bit-per-page structure…” (mostly accurate); F3 “Each UPDATE or DELETE on a heap page clears its visibility map bit…” (mostly accurate); F5 “…FROM pg_visibility( oid ) WHERE all_visible) AS vm_visible_pages FROM pg_stat_user_tables…” (mostly accurate); F6 “…(cost=0.56..18.23 rows=50) (actual time=0.341..1.204 rows=50) Heap Fetches: 2847…” (mostly accurate); F9 “Each UPDATE or DELETE on a heap page clears its visibility map bit.” (mostly accurate); F10 “…(cost=0.56..18.23 rows=50) (actual time=0.341..1.204 rows=50)…” (mostly accurate); F11 “…autovacuum_vacuum_cost_limit = 800 -- more I/O budget per round (default: 200)…” (mostly accurate); F16 “…FROM pg_visibility( oid ) WHERE all_visible…” (mostly accurate); F18 “Postgres visited the heap 2,847 times because the visibility map bits were not set on those pages…” (mostly accurate); F20 “…trigger at 1% dead tuples (default: 20%)…” (mostly accurate); F23 “…FROM pg_visibility( oid ) WHERE all_visible) AS vm_visible_pages…” (mostly accurate); F24 “…thousands of heap fetches, nearly identical latency…” (mostly accurate).
- [Revision 2](https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d?v=51) · 2026-10-19 06:26 UTC · A- · audited with v1.0.14 (approx.)
Same article text, re-audited. 6 accurate · 3 wrong · 2 caveats.
ElephantSeal: A-.
Changes: No longer reported: “…(pg_relation_size( oid ) / 8192 ):: int AS heap_pages…”; “…100–500 rows/sec Marginally 10–40%…”; “…Bulk ingest (ETL) No 100%…”; “…100–500 rows/sec Marginally 10–40% \> 500 rows/sec No 60–100%…”; “…a compact, one-bit-per-page structure…”; “Each UPDATE or DELETE on a heap page clears its visibility map bit…”; “…FROM pg_visibility( oid ) WHERE all_visible) AS vm_visible_pages FROM pg_stat_user_tables…”; “…(cost=0.56..18.23 rows=50) (actual time=0.341..1.204 rows=50) Heap Fetches: 2847…”; “Each UPDATE or DELETE on a heap page clears its visibility map bit.”; “…(cost=0.56..18.23 rows=50) (actual time=0.341..1.204 rows=50)…”; “…autovacuum_vacuum_cost_limit = 800 -- more I/O budget per round (default: 200)…”; “…FROM pg_visibility( oid ) WHERE all_visible…”; “Postgres visited the heap 2,847 times because the visibility map bits were not set on those pages…”; “…trigger at 1% dead tuples (default: 20%)…”; “…FROM pg_visibility( oid ) WHERE all_visible) AS vm_visible_pages…”; “…thousands of heap fetches, nearly identical latency…”. New: F1 “The visibility monitoring query references a nonexistent column” (misleading); F3 “A faster query after VACUUM ANALYZE does not isolate visibility-map effects” (misleading); F10 “The dashboard query reads heap pages to collect a visibility-map count” (misleading); F2 “High-write tables need aggressive autovacuum_vacuum_scale_factor (1-2%)…” (mostly accurate); F4 “A scale factor of 0.01 does not trigger vacuum at exactly 1% dead tuples” (mostly accurate).
- [Revision 3](https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d?v=53) · 2026-10-19 21:40 UTC · A- · audited with v1.0.16 (approx.)
Same article text, re-audited. 10 accurate · 4 wrong · 3 caveats.
ElephantSeal: A-.
Changes: No longer reported: “A faster query after VACUUM ANALYZE does not isolate visibility-map effects”; “The dashboard query reads heap pages to collect a visibility-map count”; “High-write tables need aggressive autovacuum_vacuum_scale_factor (1-2%)…”; “A scale factor of 0.01 does not trigger vacuum at exactly 1% dead tuples”. New: F2 “The proposed VM dashboard query reads every heap page” (misleading); F3 “The recommended scale factor does not lower the insert trigger” (misleading); F5 “A faster query after VACUUM ANALYZE does not isolate the bottleneck” (misleading); F6 “Low table-wide VM coverage does not establish a query's heap fetches” (mostly accurate); F13 “…If vm_visible_pages is significantly less than heap_pages , your index-only scans are paying for heap fetches…” (mostly accurate); F19 “The write-rate table provides no support for its numerical cutoffs” (mostly accurate).
- [Revision 4](https://pgtrue.postgres.ai/shared/brief/5a8f2450-18a1-48f7-b638-399ce6bb682d?v=56) · this page · 2026-10-21 05:00 UTC · B+ · audited with v1.0.17 (approx.) · regraded with v1.1.1 (approx.)
Same article text, re-audited. 9 accurate · 5 wrong · 1 caveat.
ElephantSeal: B+.
Changes: No longer reported: “The proposed VM dashboard query reads every heap page”; “A faster query after VACUUM ANALYZE does not isolate the bottleneck”; “The visibility monitoring query references a nonexistent column”; “Low table-wide VM coverage does not establish a query's heap fetches”; “…If vm_visible_pages is significantly less than heap_pages , your index-only scans are paying for heap fetches…”; “The write-rate table provides no support for its numerical cutoffs”. New: F1 “The VM monitoring query references a nonexistent column” (misleading); F3 “Faster execution after VACUUM ANALYZE does not isolate VM coverage” (misleading); F4 “Table-wide VM coverage does not determine a query’s heap fetches” (misleading); F5 “…SELECT count ( \* ) FROM pg_visibility( oid ) WHERE all_visible…” (misleading); F16 “Write throughput alone does not establish the table's heap-fetch percentages” (mostly accurate).