{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162", "published": "2026-10-21T03:56:16Z", "publisher": "PostgresAI", "article": {"title": "Read efficiency issues in Postgres queries", "url": "https://www.pgmustard.com/blog/read-efficiency-issues-in-postgres-queries", "date_published": "2026-02-13T13:08:00Z", "author": "Michael Christofides", "publisher": "pgMustard"}, "grade": "A", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 18 checked \u00b7 0 caveats"}, {"axis": "Applicable", "summary": "A \u00b7 0 wrong of 8 checked \u00b7 1 caveat"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 18 checked \u00b7 1 caveat"}, {"axis": "Transparent", "summary": "A \u00b7 0 wrong of 11 checked \u00b7 0 caveats"}, {"axis": "Safe", "summary": "A \u00b7 0 wrong of 7 checked \u00b7 0 caveats"}], "findings": [{"anchor": "F1", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F1", "claim": "\u2026without locking the table\u2026", "title": "Concurrent reindexing still locks the table", "explanation": "REINDEX CONCURRENTLY takes ShareUpdateExclusiveLock on the table. src/backend/commands/indexcmds.c:4035 acquires that lock. Normal reads and writes can continue, but schema changes must wait. The article's lock-free wording can cause conflicting maintenance schedules.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/commands/indexcmds.c#L4035-L4035", "label": "REL_18_2 \u00b7 src/backend/commands/indexcmds.c:4035-4035"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/reindex.sgml#L482-L485", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/reindex.sgml:482-485"}]}, {"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F2", "claim": "\u2026119782 + 49433 = 1692150\u2026", "title": "The buffer sum contains one extra zero", "explanation": "The displayed counters total 169,215 buffer accesses (derived: 119,782 + 49,433). The written total, 1,692,150 accesses, contains one extra zero. This correction leaves the displayed counters unchanged.", "verdict": "Misquoted", "sources": []}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F3", "claim": "\u2026pg_size_pretty(pg_relation_size('read_efficiency_demo'))\u2026", "title": "pg_size_pretty formats byte counts with binary units", "explanation": "pg_size_pretty converts byte counts into formatted text. REL_18_2 doc/src/sgml/func.sgml:30230-30233 defines its powers-of-two units. src/backend/utils/adt/dbsize.c:607 formats the selected size and unit.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/func.sgml#L30230-L30233", "label": "REL_18_2 \u00b7 doc/src/sgml/func.sgml:30230-30233"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/utils/adt/dbsize.c#L607-L608", "label": "REL_18_2 \u00b7 src/backend/utils/adt/dbsize.c:607-608"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F4", "claim": "\u2026pg_relation_size('read_efficiency_demo')\u2026", "title": "pg_relation_size measures the main fork by default", "explanation": "The one-argument pg_relation_size call measures the relation's main fork. src/backend/catalog/system_functions.sql:289 passes 'main'. The demonstration labels these values as heap and index space. It does not claim they include every fork or TOAST relation.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/func.sgml#L30168-L30170", "label": "REL_18_2 \u00b7 doc/src/sgml/func.sgml:30168-30170"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/catalog/system_functions.sql#L285-L289", "label": "REL_18_2 \u00b7 src/backend/catalog/system_functions.sql:285-289"}]}, {"anchor": "F5", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F5", "claim": "\u2026as long as the data being changed is not indexed\u2026", "title": "The stated HOT conditions are sufficient", "explanation": "Unchanged indexed columns and sufficient same-page space permit HOT updates. src/backend/access/heap/heapam.c:4016 checks changed columns against HOT-blocking attributes. BRIN indexes are an additional permitted case. The article states a sufficient condition, so that exception does not contradict it.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/storage.sgml#L1100-L1103", "label": "REL_18_2 \u00b7 doc/src/sgml/storage.sgml:1100-1103"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/access/heap/heapam.c#L4016-L4018", "label": "REL_18_2 \u00b7 src/backend/access/heap/heapam.c:4016-4018"}]}, {"anchor": "F6", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F6", "claim": "\u2026fillfactor setting, which controls how full each page is packed initially\u2026", "title": "Table fillfactor reserves space for updates", "explanation": "Table fillfactor controls initial page packing. REL_18_2 doc/src/sgml/ref/create_table.sgml:1593-1597 reserves remaining space for updates. src/backend/access/heap/hio.c:539 calculates the reserved space. Lower fillfactor increases opportunities for same-page updates.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/create_table.sgml#L1593-L1597", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/create_table.sgml:1593-1597"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/access/heap/hio.c#L538-L540", "label": "REL_18_2 \u00b7 src/backend/access/heap/hio.c:538-540"}]}, {"anchor": "F7", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F7", "claim": "ALTER TABLE read_efficiency_demo SET (autovacuum_enabled = off);\u2026", "title": "The demonstration disables ordinary table autovacuum", "explanation": "autovacuum_enabled=false disables ordinary automatic VACUUM and ANALYZE for this table. src/backend/postmaster/autovacuum.c:3076 preserves forced wraparound vacuuming. The demonstration does not depend on disabling that safeguard.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/create_table.sgml#L1660-L1666", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/create_table.sgml:1660-1666"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/postmaster/autovacuum.c#L3075-L3080", "label": "REL_18_2 \u00b7 src/backend/postmaster/autovacuum.c:3075-3080"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F8", "claim": "\u2026EXPLAIN (ANALYZE, BUFFERS, SERIALIZE)\u2026", "title": "The EXPLAIN options request the displayed measurement classes", "explanation": "ANALYZE executes the query and records actual statistics. BUFFERS reports block activity. SERIALIZE without an argument selects TEXT. REL_18_2 doc/src/sgml/ref/explain.sgml:231-233 requires ANALYZE for serialization. The demonstrated command satisfies that requirement.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/explain.sgml#L120-L121", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/explain.sgml:120-121"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/explain.sgml#L185-L187", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/explain.sgml:185-187"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/explain.sgml#L231-L233", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/explain.sgml:231-233"}]}, {"anchor": "F9", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F9", "claim": "\u2026these take heavy locks, even preventing concurrent reads\u2026", "title": "VACUUM FULL and CLUSTER block concurrent table access", "explanation": "VACUUM FULL and CLUSTER require ACCESS EXCLUSIVE on the table. REL_18_2 doc/src/sgml/maintenance.sgml:131-134 documents VACUUM FULL. doc/src/sgml/ref/cluster.sgml:76-79 documents CLUSTER. Both operations block ordinary reads and writes.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/maintenance.sgml#L131-L134", "label": "REL_18_2 \u00b7 doc/src/sgml/maintenance.sgml:131-134"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/cluster.sgml#L76-L79", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/cluster.sgml:76-79"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/commands/cluster.c#L140-L142", "label": "REL_18_2 \u00b7 src/backend/commands/cluster.c:140-142"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/cluster.sgml#L76-L79", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/cluster.sgml:76-79"}, {"url": "https://www.postgresql.org/docs/current/routine-vacuuming.html", "label": "https://www.postgresql.org/docs/current/routine-vacuuming.html"}]}, {"anchor": "F10", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F10", "claim": "\u2026Postgres can use a super-efficient Index Only Scan\u2026", "title": "A covering index can support an index-only scan", "explanation": "A covering index can support an index-only scan. src/backend/executor/nodeIndexonlyscan.c:161 checks the visibility map. Line 169 fetches the heap when visibility requires it. The article's 'can' permits the efficient case without guaranteeing zero heap fetches.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/indices.sgml#L1216-L1220", "label": "REL_18_2 \u00b7 doc/src/sgml/indices.sgml:1216-1220"}, {"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/src/backend/executor/nodeIndexonlyscan.c#L161-L169", "label": "REL_18_2 \u00b7 src/backend/executor/nodeIndexonlyscan.c:161-169"}]}, {"anchor": "F11", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F11", "claim": "We can fix the index bloat by reindexing\u2026", "title": "Reindexing can remove index bloat", "explanation": "REINDEX replaces an index with a rebuilt copy. REL_18_2 doc/src/sgml/ref/reindex.sgml:56-61 describes reduced space consumption from excluding dead pages. This supports rebuilding the demonstration's bloated primary-key index.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/reindex.sgml#L56-L61", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/reindex.sgml:56-61"}]}, {"anchor": "F14", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F14", "claim": "Old row versions take up space\u2026", "title": "VACUUM makes obsolete row-version storage reusable", "explanation": "PostgreSQL's routine-vacuuming documentation confirms that ordinary VACUUM removes dead versions from tables and indexes. It marks their storage for reuse. Reusable internal storage does not necessarily reduce the relation's file size.", "verdict": "Accurate", "sources": [{"url": "https://www.postgresql.org/docs/current/routine-vacuuming.html", "label": "https://www.postgresql.org/docs/current/routine-vacuuming.html"}]}, {"anchor": "F15", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F15", "claim": "\u2026bloat isn\u2019t the only way queries can end up reading more data than necessary\u2026", "title": "Poor physical locality can increase page accesses without bloat", "explanation": "Matching rows can occupy fewer pages after physical clustering. REL_18_2 doc/src/sgml/ref/cluster.sgml:145-150 describes that benefit for indexed ranges and repeated keys. Excessive page accesses alone do not establish bloat.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/cluster.sgml#L145-L150", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/cluster.sgml:145-150"}]}, {"anchor": "F16", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F16", "claim": "\u2026Postgres does not have a way to automatically keep data in a certain order\u2026", "title": "PostgreSQL does not maintain CLUSTER's physical ordering", "explanation": "CLUSTER performs a one-time physical reorder. Subsequent updates do not maintain index order in the heap. REL_18_2 doc/src/sgml/ref/cluster.sgml:48-50 states this restriction.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/ref/cluster.sgml#L48-L50", "label": "REL_18_2 \u00b7 doc/src/sgml/ref/cluster.sgml:48-50"}]}, {"anchor": "F20", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F20", "claim": "\u2026Buffers: shared hit=119782 read=49433\u2026", "title": "The displayed buffer counts increase 9.81\u00d7", "explanation": "The displayed buffer counts support the stated almost-tenfold increase (derived: 169,215 / 17,242 = 9.81).", "verdict": "Accurate", "sources": []}, {"anchor": "F21", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F21", "claim": "\u2026Execution Time: 1116.107 ms\u2026", "title": "The displayed execution times support a 4.78\u00d7 slowdown", "explanation": "The displayed execution times support the stated almost-fivefold increase (derived: 1,116.107 ms / 233.598 ms = 4.78).", "verdict": "Accurate", "sources": []}, {"anchor": "F22", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F22", "claim": "\u2026Execution Time: 0.183 ms\u2026", "title": "The displayed CLUSTER comparison supports an approximately 2\u00d7 speedup", "explanation": "The displayed execution times support a 1.86\u00d7 speedup (derived: 0.340 ms / 0.183 ms = 1.86).", "verdict": "Accurate", "sources": []}, {"anchor": "F23", "url": "https://pgtrue.postgres.ai/shared/brief/00c867cf-5bc1-4737-b6ff-a3fd9a540162#F23", "claim": "\u2026those are 8 KB pages, so unsurprisingly about 135 MB\u2026", "title": "The initial buffer count agrees with the displayed 135 MB", "explanation": "The displayed 17,242 buffers correspond to 134.7 MiB at 8 KiB per page. PostgreSQL labels binary megabytes MB. The displayed 135 MB agrees with that conversion.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/5a461dc4dbf72a1ec281394a76eb36d68cbdd935/doc/src/sgml/func.sgml#L30217-L30235", "label": "REL_18_2 \u00b7 doc/src/sgml/func.sgml:30217-30235"}]}]}