Limited beta · What is this?

pgTrue is under active development: reports may contain significant mistakes, inaccuracies, or bugs. Please report anything you find to pgtrue@postgres.ai.

pgTrue is an independent fact-check of technical Postgres articles. Read the questions and answers.

pgTrue fact-check

ElephantSeal BLimited coverageOpen: the benchmark cannot yet be rerun from what is published

Embed

The ElephantSeal always shows this report's latest edition and links here. Copies cached elsewhere may update later.

[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&theme=light)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&amp;theme=light" alt="pgTrue fact-check" width="90" height="20" loading="lazy" decoding="async" style="display:inline-block;width:90px;height:20px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&theme=light
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&theme=light
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 90
   :height: 20
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&theme=dark)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&amp;theme=dark" alt="pgTrue fact-check" width="90" height="20" loading="lazy" decoding="async" style="display:inline-block;width:90px;height:20px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&theme=dark
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13&theme=dark
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 90
   :height: 20
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13" alt="pgTrue fact-check" width="90" height="20" loading="lazy" decoding="async" style="display:inline-block;width:90px;height:20px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958.svg?v=13
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 90
   :height: 20
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&theme=light)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&amp;theme=light" alt="pgTrue fact-check" width="240" height="240" loading="lazy" decoding="async" style="display:inline-block;width:240px;height:240px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&theme=light
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&theme=light
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 240
   :height: 240
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&theme=dark)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&amp;theme=dark" alt="pgTrue fact-check" width="240" height="240" loading="lazy" decoding="async" style="display:inline-block;width:240px;height:240px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&theme=dark
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13&theme=dark
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 240
   :height: 240
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13" alt="pgTrue fact-check" width="240" height="240" loading="lazy" decoding="async" style="display:inline-block;width:240px;height:240px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/radar.svg?v=13
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 240
   :height: 240
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&theme=light)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&amp;theme=light" alt="pgTrue fact-check" width="480" height="240" loading="lazy" decoding="async" style="display:inline-block;width:480px;height:240px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&theme=light
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&theme=light
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 480
   :height: 240
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&theme=dark)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&amp;theme=dark" alt="pgTrue fact-check" width="480" height="240" loading="lazy" decoding="async" style="display:inline-block;width:480px;height:240px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&theme=dark
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13&theme=dark
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 480
   :height: 240
[![pgTrue fact-check](https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13)](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958)
<a href="https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958"><img src="https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13" alt="pgTrue fact-check" width="480" height="240" loading="lazy" decoding="async" style="display:inline-block;width:480px;height:240px"></a>
https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13
.. image:: https://pgtrue.postgres.ai/badge/25eecb81-8ef3-4705-b362-35732dd9d958/wide.svg?v=13
   :target: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
   :alt: pgTrue fact-check
   :width: 480
   :height: 240

Click the snippet to select all of it, then copy. Where SVG is stripped, as in some email clients and feed readers, change .svg to .png. PNG uses the light theme for Auto. For Markdown PNG embeds, use the HTML snippet where supported to preserve the display size.

Optional colours: append &color=26798E or &labelColor=333C47 after a theme query (use ? for the first parameter). Use 3- or 6-digit hex.

For pages with a light background.

For pages with a dark background. The ElephantSeal gets a thin edge so it does not blend in.

Auto follows the reader's light or dark setting where the host supports it, and shows the light ElephantSeal where it does not.

On a light page
On a dark page

How TABLESAMPLE picks rows (opens in new tab)

boringsql.com
Check before you follow it: 2 claims are wrong.
2
inaccuracy
0
dangerous-recipe
0
misleading
1
imprecise
0
transcription
0
aged
0
withdrawn
5
verified-accurate

Factual B− · Applicable A · Consistent A · Transparent C · Safe —

ReportTechnical fact-check, edition 3 pgTrue versionaudited with v1.0.14 (approx.) · regraded with v1.1.3 Issued EditionUpdated after review. Corrections are listed below. SubmittedSubmitted by the PostgresAI team. Author responseNo written reply from the author. We re-audited this article 1 time; see Revisions below. Policy: right-of-reply and corrections policy.

Inaccuracies

F3

Sample scans can execute inside parallel workers

INACCURATEFactual · holds up after review

Claim ledger

Article says
…a sample scan runs in the leader process…
What is true
SampleScan has parallel_aware=false, but its parallel_safe flag follows the relation. allpaths.c explicitly permits safe sampling inside workers. A sample scan can form a non-parallel inner input within a parallel join. TABLESAMPLE does not force every surrounding plan to run serially.
So what
Check EXPLAIN for parallel work on other join inputs instead of rejecting parallel plans whenever TABLESAMPLE appears.
Charitable reading
The displayed plan can be serial, and PostgreSQL cannot divide one SampleScan among workers. Those facts do not require leader-only execution.

Source

Source · REL_18_6 · doc/src/sgml/parallel.sgml:310-360inner side of the join may be any kind of non-parallel plan that is otherwise supported by the planner provided that it is safe to run within a parallel worker.
In the article · section “The join doesn't shrink”

In the article

excerpt · section “The join doesn't shrink” · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

The join doesn't shrink

The sample scan did its part, 202 pages against the full 18,085. The hash over customers still reads all 222 of its pages, because TABLESAMPLE only shrinks the table it sits on, and building the hash is 11.5 ms of the 25.6. The query gets 3.3× faster, not 90×. Most of what remains is the table the sample never touched. The workers are gone too: a sample scan runs in the leader process, so the plan falls back to serial however big the table is.

SET enable_hashjoin = off ; SET enable_mergejoin = off ;
All sources and excerpts · 3
Evidence inner side of the join may be any kind of non-parallel plan that is otherwise supported by the planner provided that it is safe to run within a parallel worker.
Evidence * Table sampling can be pushed down to workers if the sample * function and its arguments are safe.
Evidence pathnode->parallel_aware = false; pathnode->parallel_safe = rel->consider_parallel; pathnode->parallel_workers = 0;
How the review tested this

Review: We distinguished the displayed serial plan from the general leader-only claim. allpaths.c permits safe sampling inside workers. The finding preserves the restriction against dividing one SampleScan among workers. We distinguished the displayed serial plan from a universal leader-only rule. allpaths.c permits safe sampling inside workers. parallel.sgml permits a safe nonparallel inner input. The correction preserves the displayed measurement.

F4

Inaccuracy: “…a scan reads all of them from disk, every time…”

INACCURATEFactual · partly holds after review

Claim ledger

Article says
…a scan reads all of them from disk, every time…
What is true
A full scan does not necessarily require physical storage reads for every page. PostgreSQL relies on the operating system cache (E-11, E-32). Measure storage I/O before assigning every full scan a physical-read cost of 1 TB.
So what
Measure cache behavior and storage I/O before treating every full scan as a terabyte of physical reads.

Source

Source · REL_18_6 · doc/src/sgml/config.sgml:1727-1760because <productname>PostgreSQL</productname> also relies on the operating system cache, it is unlikely that an allocation of more than
In the article

In the article

excerpt · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

shared hit=18085 is one buffer access per page, every page found already in memory ( Reading Buffer statistics in EXPLAIN output goes through the counters). At 141 MB of heap size that's nothing. Take a 1 TB table with 134 million pages: a scan reads all of them from disk, every time, however small the answer is.

All sources and excerpts · 2
Evidence because <productname>PostgreSQL</productname> also relies on the operating system cache, it is unlikely that an allocation of more than
Evidence because <productname>PostgreSQL</productname> also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to <varname>shared_buffers</varname> will work better than a
How the review tested this

Review: We tested the charitable assumption that 1 TB exceeds available caches. The article states no such condition. E-11 supports operating system caching but does not document bulk-read ring behavior.

Dangerous or recipe bugsNone in this edition.

Misleading / imprecise

F2

Imprecise: “None of them when you need a filtered subset…”

IMPRECISEApplicable · partly holds after review

Claim ledger

Article says
None of them when you need a filtered subset…
What is true
TABLESAMPLE chooses rows before WHERE, so it cannot guarantee a requested qualifying sample size. The article demonstrates filtering that sample. Its conclusion says none of the methods suit filtered subsets. That wording also excludes key hashing, which can accompany another WHERE predicate.
So what
Use TABLESAMPLE with WHERE for approximate filtered results, or combine the key-hash condition with the desired predicate.

Source

Source · REL_18_6 · doc/src/sgml/ref/select.sgml:438-443This sampling precedes the application of any other filters such as <literal>WHERE</literal> clauses.
In the article · section “Which to reach for”

In the article

excerpt · section “Which to reach for” · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

Which to reach for

SYSTEM for a quick number over a column that has nothing to do with insert order. BERNOULLI when it might, and reading the whole table once is affordable. A hashed key when the subset has to be the same rows tomorrow, or has to keep its foreign keys intact. None of them when you need a filtered subset: the sample is chosen before your WHERE runs, so the filter only trims a draw that was already made.

All sources and excerpts · 2
Evidence This sampling precedes the application of any other filters such as <literal>WHERE</literal> clauses.
Evidence return hash_uint32_extended(lohalf, PG_GETARG_INT64(1));
How the review tested this

Review: We read the conclusion as a warning about sampling before filtering. The article already demonstrates a working filtered TABLESAMPLE query. The remaining defect is the conclusion's blanket wording, especially its inclusion of key hashing. We tested the reading that filtering cannot guarantee enough qualifying rows. That caution holds, but excluding key hashing and approximate filtered queries remains too broad.

Verified accurate

F5

Verified accurate: “…Both built-in sampling methods hash part of that address together with a seed…”

ACCURATEFactual · partly holds after review

Claim ledger

Article says
…Both built-in sampling methods hash part of that address together with a seed…
What is true
SYSTEM hashes the block number and seed (E-2). BERNOULLI hashes the block number, tuple offset, and seed (E-13). Equal inputs preserve selection decisions. Heap sampling skips non-normal item pointers (E-25). These ranges verify address-based selection, without verifying HOT update placement or measured retention.

Source

Source · REL_18_6 · src/backend/access/tablesample/bernoulli.c:195-220* We compute the hash by applying hash_any to an array of 3 uint32's * containing the block, offset, and seed.
In the article · section “Every row has an address”

In the article

excerpt · section “Every row has an address” · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

Every row has an address

Both built-in sampling methods hash part of that address together with a seed and keep whatever hashes under a 1% cutoff. They differ only in which part. SYSTEM , in src/backend/access/tablesample/system.c , hashes the page number (trimmed to the lines that matter):

hashinput [ 0 ] = nextblock; /* page */ hashinput [ 1 ] = sampler -> seed; hash = DatumGetUInt32 ( hash_any (( const unsigned char * ) hashinput , ( int ) sizeof (hashinput))); if (hash < sampler -> cutoff) /* keep the whole page */
All sources and excerpts · 4
Evidence * We compute the hash by applying hash_any to an array of 3 uint32's * containing the block, offset, and seed.
Evidence * We compute the hash by applying hash_any to an array of 2 uint32's * containing the block number and seed.
Evidence /* Skip invalid tuple pointers. */ itemid = PageGetItemId(page, tupoffset); if (!ItemIdIsNormal(itemid)) continue;
Evidence seed = DatumGetUInt32(DirectFunctionCall1(hashfloat8, datum));
How the review tested this

Review: We checked both hash inputs and tuple-pointer handling. They support address-based selection. These ranges do not establish HOT tuple placement or the displayed membership changes.

F6

Verified accurate: “…larger than a quarter of shared_buffers…”

ACCURATEFactual · partly holds after review

Claim ledger

Article says
…larger than a quarter of shared_buffers…
What is true
heapam.c selects BAS_BULKREAD for eligible non-local relations exceeding NBuffers / 4 blocks. The caller must permit the strategy (E-15). shared_buffers sets shared-buffer memory (E-11). These ranges verify the threshold and eligibility conditions.

Source

Source · REL_18_6 · doc/src/sgml/config.sgml:1727-1760because <productname>PostgreSQL</productname> also relies on the operating system cache, it is unlikely that an allocation of more than
In the article

In the article

excerpt · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

Postgres reads tables larger than a quarter of shared_buffers through a small ring buffer. See more in introduction to buffers .

All sources and excerpts · 2
Evidence because <productname>PostgreSQL</productname> also relies on the operating system cache, it is unlikely that an allocation of more than
Evidence if (!RelationUsesLocalBuffers(scan->rs_base.rs_rd) && scan->rs_nblocks > NBuffers / 4) { allow_strat = (scan->rs_base.rs_flags & SO_ALLOW_STRAT) != 0;
How the review tested this

Review: We checked local-buffer exclusions, caller permission, and the strict quarter-buffer threshold. E-15 confirms BAS_BULKREAD selection. Neither cited range establishes how its ring limits cache displacement.

F7

The join settings support the alternative-plan comparison

ACCURATEFactual · holds up after review

Claim ledger

Article says
…SET enable_hashjoin = off ; SET enable_mergejoin = off ;…
What is true
enable_hashjoin and enable_mergejoin control the planner's respective join methods. Both default to on. Setting both off changes subsequent planning for the illustrated inner join. The source separately permits these methods for FULL joins when necessary.
Charitable reading
The settings support this inner-join comparison. FULL joins can retain otherwise disabled methods when required.

Source

Source · REL_18_6 · doc/src/sgml/config.sgml:5644-5656Enables or disables the query planner's use of hash-join plan types. The default is <literal>on</literal>.
In the article · section “The join doesn't shrink”

In the article

excerpt · section “The join doesn't shrink” · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

The join doesn't shrink

SET enable_hashjoin = off ; SET enable_mergejoin = off ;
SELECT count ( DISTINCT customer_id) FROM orders TABLESAMPLE SYSTEM ( 1 ) REPEATABLE ( 7 );
All sources and excerpts · 4
Evidence Enables or disables the query planner's use of hash-join plan types. The default is <literal>on</literal>.
Evidence Enables or disables the query planner's use of merge-join plan types. The default is <literal>on</literal>.
Evidence if (enable_hashjoin || jointype == JOIN_FULL) hash_inner_and_outer(root, joinrel, outerrel, innerrel,
Evidence if (enable_mergejoin || jointype == JOIN_FULL) extra.mergeclause_list = select_mergejoin_clauses(root,
How the review tested this

Review: We checked whether disabled join methods can remain available. joinpath.c preserves FULL-join exceptions, which the finding states. The illustrated query uses an inner join. We checked whether these controls guarantee every displayed performance claim. The finding makes no such guarantee. Documentation confirms both controls, and joinpath.c confirms the stated FULL JOIN exceptions.

F8

ANALYZE uses its own block and row sampling

ACCURATEFactual · holds up after review

Claim ledger

Article says
ANALYZE builds pg_stats from a sample too…
What is true
ANALYZE initializes BlockSampler with a random seed from pg_global_prng_state. It then samples rows within selected blocks. pg_stats exposes information stored in pg_statistic. Changing samples can change statistics without changes to table data.
Charitable reading
ANALYZE stores statistics in pg_statistic. The sentence uses pg_stats as the user-facing name for those statistics.

Source

Source · REL_18_6 · src/backend/commands/analyze.c:1223-1233randseed = pg_prng_uint32(&pg_global_prng_state); nblocks = BlockSampler_Init(&bs, totalblocks, targrows, randseed);
In the article · section “Which to reach for”

In the article

excerpt · section “Which to reach for” · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

Which to reach for

ANALYZE builds pg_stats from a sample too, with its own block sampler and a seed you don't get to set, which is why the numbers move between runs even when the data hasn't.

All sources and excerpts · 3
Evidence randseed = pg_prng_uint32(&pg_global_prng_state); nblocks = BlockSampler_Init(&bs, totalblocks, targrows, randseed);
Evidence * Stage two scans these blocks and uses the Vitter algorithm to create * a random sample of targrows rows (or less, if there are less in the * sample of blocks).
Evidence The view <structname>pg_stats</structname> provides access to the information stored in the <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> catalog.
How the review tested this

Review: We checked whether pg_stats names the storage catalog and whether sampling operates only on blocks. The finding correctly identifies the view and both sampling stages. We checked the distinction between pg_stats and pg_statistic. The finding identifies pg_stats as a view. analyze.c confirms random block sampling followed by row sampling.

F11

18,085 pages correctly round to 141 MiB

ACCURATEFactual · holds up after review

Claim ledger

Article says
…all 18,085 of them (141 MB)…
What is true
The size conversion is correct. At 8 KiB per page, 18,085 pages occupy 141 MiB rounded (derived: 18,085 × 8,192 / 1,048,576).
Charitable reading
PostgreSQL commonly labels binary sizes kB and MB. We used 8 KiB pages for this conversion.

Source

Source · REL_18_6 · doc/src/sgml/config.sgml:1743-1743that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
In the article

In the article

excerpt · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

Most exploratory questions against a large table only need a rough answer, but without an index on status , even "roughly how many shipped orders" costs a full scan. On the two-million-row orders table, Postgres has to read every single 8 kB page, all 18,085 of them (141 MB), just to count matching rows.

EXPLAIN (ANALYZE, BUFFERS) SELECT count ( * ) FROM orders WHERE status = 'shipped' ;
All sources and excerpts · 1
Evidence that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
How the review tested this

Review: We recalculated 18,085 × 8,192 / 1,048,576 = 141.2890625 MiB. Rounding gives 141 MiB. The finding validates only this conversion. We recalculated 18,085 pages at 8,192 bytes per page: 141.289 MiB. Rounding gives 141 MiB. The finding states the binary-unit interpretation and does not verify the measured page count.

Notes

2 not graded: findings no reader would act on differently
F1

Note: “Two independent address draws…”

NOTEpartly holds after review

Claim ledger

Article says
Two independent address draws…
What is true
Equal SYSTEM percentages and REPEATABLE seeds coordinate selection of matching block numbers across tables. These samples are correlated. This does not invalidate the displayed join count or the recommendation to hash foreign keys. The evidence establishes incorrect terminology without demonstrating an incorrect query result.
So what
Use different REPEATABLE seeds when independent page samples are required.

Source

Source · REL_18_6 · src/backend/access/tablesample/system.c:185-208* We compute the hash by applying hash_any to an array of 2 uint32's * containing the block number and seed.

Not graded: no reader would act differently on it.

In the article · section “The join doesn't shrink”

In the article

excerpt · section “The join doesn't shrink” · as fetched 2026-10-19 · open in article ↗ (opens in new tab)

The join doesn't shrink

The real join has two million rows. Two independent address draws keep 288 of them, because a sampled order finds its customer only when both page hashes kept the matching pair. When a sampled pair of tables has to stay joinable, hashing the foreign key on both sides is the way to do it.

All sources and excerpts · 2
Evidence * We compute the hash by applying hash_any to an array of 2 uint32's * containing the block number and seed.
Evidence seed = DatumGetUInt32(DirectFunctionCall1(hashfloat8, datum));
How the review tested this

Review: Equal seeds coordinate page selection. However, these citations establish no incorrect estimator or wrong query result. The article recommends foreign-key hashing. The silent-wrong-result consequence exceeds the evidence. We tested whether different table identities separate the draws. They do not. However, these citations establish dependence, not an incorrect displayed join count or a silently wrong estimate. The recorded consequence exceeds the evidence.

F9

A rewrite can preserve some numeric CTID values

NOTEholds up after review

Claim ledger

Article says
…every row gets a new address…
What is true
rewriteheap.c assigns each tuple a block number and item offset in the destination heap. CTID contains those two values, without file identity. A tuple can receive the same numeric pair after rewriting. Rewrites do not guarantee a different CTID for every row.
Charitable reading
A rewrite assigns tuple positions in a new heap. Calling those positions new is reasonable, but their numeric CTID values need not differ.

Source

Source · REL_18_6 · src/backend/access/heap/rewriteheap.c:670-688/* Update caller's t_self to the actual position where it was stored */ ItemPointerSet(&(tup->t_self), state->rs_blockno, newoff);

Not graded: no reader would act differently on it.

In the article

In the article

Article · exact quote · open in article ↗ (opens in new tab)…every row gets a new address…
All sources and excerpts · 3
Evidence /* Update caller's t_self to the actual position where it was stored */ ItemPointerSet(&(tup->t_self), state->rs_blockno, newoff);
Evidence item (<type>ItemPointer</type>, also known as <type>CTID</type>) created by <productname>PostgreSQL</productname> consists of a page number and the index of an item identifier.
Evidence state->rs_blockno = RelationGetNumberOfBlocks(new_heap);
How the review tested this

Review: We tested whether a new physical file necessarily changes numeric CTIDs. CTIDs exclude file identity, and rewriteheap.c assigns destination positions. The limited note remains justified. We read new address as a position in the replacement heap. That reading is reasonable. CTID still contains only block and offset, so numeric equality remains possible. The existing note severity fits.

More in this report

Section checks · 5 sections

Section checks

AspectGradeFindingsCoverage
IntroductionB+1 inaccuracy · 2 verified-accurate100% of claims (24 of 24, plus 14 that need data we do not have)
Row addressesA1 verified-accurate100% of claims (12 of 12, plus 1 that need data we do not have)
RepeatabilityAnone100% of claims (14 of 14, plus 14 that need data we do not have)
JoinsB+1 inaccuracy · 1 verified-accurate100% of claims (13 of 13, plus 20 that need data we do not have)
Method choiceA1 imprecise · 1 verified-accurate100% of claims (5 of 5, plus 3 that need data we do not have)
Coverage and assessment · Checked 86 of 98 Postgres claims across 9 sections; 1 section below half

B — the findings address the article's main subject. What we did not check is listed below. The findings directly check TABLESAMPLE address selection, repeatability, join behavior, and method-choice recommendations against PostgreSQL 18.6 source.

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.

What we did not check

  • We did not reproduce the displayed timings, row counts, retention percentages, or variance measurements.
  • We did not verify the original page's SQL formatting.
  • We did not verify five distinct claims against primary sources.
  • We did not verify the sampling implementations, parallel-plan restrictions, or ANALYZE seed controls.
  • We did not reproduce the measurements or verify the PostgreSQL 18.6 runtime used for them.
  • We did not establish which claims changed between publication and October 19, 2026.
  • We did not reproduce the article's timings, storage sizes, sample draws, update retention counts, or 200-seed comparisons.
  • We did not verify that all 50,001 customers have orders.
  • Section “Setup”: we checked 4 of 17 checkable claims.
  • We could not decide whether the published benchmark details are complete.
  • We could not decide whether the article depends on finding F3.
  • We could not decide whether the article depends on finding F4.
Checked 86 of 98 Postgres claims across 9 sections; 1 section below half
  • Introduction: 24 of 24 Postgres claims checked, plus 14 that need data we do not have; not counted: 3 product or opinion, 1 duplicate, 3 not a claim
  • Setup: 4 of 14 Postgres claims checked, plus 3 that need data we do not have; not counted: 1 product or opinion, 1 not a claim; not checked: 10 for other reasons
  • Row addresses: 12 of 12 Postgres claims checked, plus 1 that need data we do not have; not counted: 2 not a claim
  • Page bundles: 7 of 9 Postgres claims checked, plus 8 that need data we do not have; not counted: 1 duplicate, 1 not a claim; not checked: 2 for other reasons
  • Repeatability: 14 of 14 Postgres claims checked, plus 14 that need data we do not have; not counted: 3 not a claim
  • Key hashing: 7 of 7 Postgres claims checked, plus 10 that need data we do not have; not counted: 1 product or opinion, 1 duplicate, 1 not a claim
  • Joins: 13 of 13 Postgres claims checked, plus 20 that need data we do not have; not counted: 1 product or opinion, 3 duplicate, 2 not a claim
  • Method choice: 5 of 5 Postgres claims checked, plus 3 that need data we do not have; not counted: 3 duplicate, 1 not a claim
  • Footer: no checkable claims; not counted: 2 product or opinion, 2 not a claim

Average of 4 axes: 3.18 · benchmark not reproducible, one step off (no hardware) · result B

Some explanatory text is not shown in this edition; the grade and findings are complete.

Scorecard · the five axes
FACTS scorecard Scorecard radar, 5 axes, bigger is better. Overall B. Factual B- · 2 wrong of 8 checked · 0 caveats. Applicable A · 0 wrong of 7 checked · 1 caveat. Consistent A · 0 wrong of 8 checked · 0 caveats. Transparent C · 0 wrong of 3 checked · 0 caveats · reproducibility: C (no hardware). Safe not applicable (n/a). B- 2 wrong of 8 checked · 0 caveatsFactual B-2 wrong of 80 caveats A 0 wrong of 7 checked · 1 caveatApplicable A0 wrong of 71 caveat A 0 wrong of 8 checked · 0 caveatsConsistent A0 wrong of 80 caveats C 0 wrong of 3 checked · 0 caveats reproducibility: C (no hardware)Transparent C0 wrong of 30 caveatsreproducibility: C(no hardware) not applicable (n/a), nothing to checkSafe n/anothingto check B

By topic: Introduction — 3 findings, 1 wrong · Row addresses — 1 finding, 0 wrong · Joins — 2 findings, 1 wrong · Method choice — 2 findings, 0 wrong

Further out is better. Each axis has its own letter, from the wrong claims and caveats among the claims we checked of that kind.

Checked on the FACTS: Factual, Applicable, Consistent, Transparent, Safe. Clockwise: Factual (is it true?), Applicable (does it apply to my setup, today?), Consistent (does it agree with itself?), Transparent (can I check it myself?), Safe (can I run this on prod?).

We checked 8 claims, 28 commands scanned.

AxisLetterWrongCaveatsCheckedCoverage
FactualB-208assessed: B- · 2 wrong of 8 checked · 0 caveats
ApplicableA017assessed: A · 0 wrong of 7 checked · 1 caveat
ConsistentA008assessed: A · 0 wrong of 8 checked · 0 caveats
TransparentC003assessed: C · 0 wrong of 3 checked · 0 caveats · reproducibility: C (no hardware)
Safe—000assessed
Topics · 5 topics

Topics

TopicFactualApplicableConsistentTransparentSafe
Introduction1 issue 3 checked F4 F6 F110 issues 3 checked0 issues 3 checked0 issues 2 checked
Row addresses0 issues 1 checked F50 issues 1 checked0 issues 1 checked
Repeatability
Joins1 issue 2 checked F3 F70 issues 2 checked0 issues 2 checked
Method choice0 issues 2 checked F81 issue 1 checked F20 issues 2 checked0 issues 1 checked

Issues found among the claims checked, per topic and axis. Each link goes to the finding behind the count.

Revisions: 2 · C+ -> B

We audited this article 2 times. Each row is the final edition of one audit. Letters and findings of earlier revisions stay readable at their own address.

  1. Revision 1 · 2026-10-12 02:44 UTC · C+ · audit version not recorded · regrade version not recorded

    Article as first submitted. 13 accurate · 2 wrong · 1 caveat.

    ElephantSeal: C+.

    Changes: First audit. Open: F2 “Sample scans can execute inside parallel workers” (false); F1 “Full scans do not necessarily read every page from physical disk” (misleading); F12 “Two independent address draws keep 288 of them…” (mostly accurate).

  2. Revision 2 · this page · 2026-10-19 07:59 UTC · B · audited with v1.0.14 (approx.) · regraded with v1.1.3

    Same article text, re-audited. 5 accurate · 2 wrong · 1 caveat.

    ElephantSeal: B. Open: the benchmark cannot yet be rerun from what is published.

    Changes: No longer reported: “Full scans do not necessarily read every page from physical disk”; “Two independent address draws keep 288 of them…”. New: F4 “…a scan reads all of them from disk, every time…” (false); F2 “None of them when you need a filtered subset…” (mostly accurate).

Questions and answers

Questions and answers

What is pgTrue?

pgTrue is an independent fact-check of technical Postgres articles, made by PostgresAI. It helps you check advice before you use it.

What does the letter grade mean?

The letter grade summarizes the claims we checked. Five axes show what we checked:

  • Factual: is it true?
  • Applicable: does it apply to my setup, today?
  • Consistent: does it agree with itself?
  • Transparent: can I check it myself?
  • Safe: can I run this in production?

What is the ElephantSeal?

The ElephantSeal is the mark an article earns. It always shows the latest edition. “Open:” lists what is still open.

Can an author reply?

Authors can ask us to correct a finding, reply to it, or withdraw it. Right-of-reply policy.

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: How TABLESAMPLE picks rows

Article title: How TABLESAMPLE picks rows
Article URL: https://boringsql.com/posts/tablesample
Report URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958
Audited revision: 2 of 2, 2026-10-19 07:59:41 UTC
Overall letter: B

## Axes

- Factual: B- · 2 wrong · 8 checked · 0 caveats · assessed
- Applicable: A · 0 wrong · 7 checked · 1 caveats · assessed
- Consistent: A · 0 wrong · 8 checked · 0 caveats · assessed
- Transparent: C · 0 wrong · 3 checked · 0 caveats · assessed
- Safe: — · 0 wrong · 0 checked · 0 caveats · assessed

ElephantSeal: B.
Open conditions: the benchmark cannot yet be rerun from what is published.

## Report metadata

- Report: Technical fact-check, edition 3
- pgTrue version: audited with v1.0.14 (approx.) · regraded with v1.1.3
- Issued: 2026-10-19
- 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 1 time; see Revisions below. Policy: [right-of-reply and corrections policy](/pgtrue/security).

## Findings needing a change (3)

### F3 · Inaccurate · Factual · Sample scans can execute inside parallel workers
Location: excerpt · section “The join doesn't shrink” · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=a%20sample%20scan%20runs%20in%20the%20leader%20process)
Article says:
```text
…a sample scan runs in the leader process…
```
What is true:
SampleScan has parallel_aware=false, but its parallel_safe flag follows the relation. allpaths.c explicitly permits safe sampling inside workers. A sample scan can form a non-parallel inner input within a parallel join. TABLESAMPLE does not force every surrounding plan to run serially.
So what:
Check EXPLAIN for parallel work on other join inputs instead of rejecting parallel plans whenever TABLESAMPLE appears.
Charitable reading:
The displayed plan can be serial, and PostgreSQL cannot divide one SampleScan among workers. Those facts do not require leader-only execution.
Review: We distinguished the displayed serial plan from the general leader-only claim. allpaths.c permits safe sampling inside workers. The finding preserves the restriction against dividing one SampleScan among workers. We distinguished the displayed serial plan from a universal leader-only rule. allpaths.c permits safe sampling inside workers. parallel.sgml permits a safe nonparallel inner input. The correction preserves the displayed measurement.

Sources:
- [REL_18_6 · doc/src/sgml/parallel.sgml:310-360](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/parallel.sgml#L310-L360)
  Excerpt:
  ```text
  inner side of the join may be any kind of non-parallel plan that is
    otherwise supported by the planner provided that it is safe to run within
    a parallel worker.
  ```
- [REL_18_6 · src/backend/optimizer/path/allpaths.c:625-644](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/path/allpaths.c#L625-L644)
  Excerpt:
  ```text
  * Table sampling can be pushed down to workers if the sample
			 * function and its arguments are safe.
  ```
- [REL_18_6 · src/backend/optimizer/util/pathnode.c:1011-1028](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/util/pathnode.c#L1011-L1028)
  Excerpt:
  ```text
  pathnode->parallel_aware = false;
	pathnode->parallel_safe = rel->consider_parallel;
	pathnode->parallel_workers = 0;
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F3

### F4 · Inaccurate · Factual · Inaccuracy: “…a scan reads all of them from disk, every time…”
Location: excerpt · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=a%20scan%20reads%20all%20of%20them%20from%20disk%2C%20every%20time)
Article says:
```text
…a scan reads all of them from disk, every time…
```
What is true:
A full scan does not necessarily require physical storage reads for every page. PostgreSQL relies on the operating system cache (E-11, E-32). Measure storage I/O before assigning every full scan a physical-read cost of 1 TB.
So what:
Measure cache behavior and storage I/O before treating every full scan as a terabyte of physical reads.
Review: We tested the charitable assumption that 1 TB exceeds available caches. The article states no such condition. E-11 supports operating system caching but does not document bulk-read ring behavior.

Sources:
- [REL_18_6 · doc/src/sgml/config.sgml:1727-1760](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L1727-L1760)
  Excerpt:
  ```text
  because <productname>PostgreSQL</productname> also relies on the
        operating system cache, it is unlikely that an allocation of more than
  ```
- [REL_18_6 · doc/src/sgml/config.sgml:1754-1756](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L1754-L1756)
  Excerpt:
  ```text
  because <productname>PostgreSQL</productname> also relies on the
        operating system cache, it is unlikely that an allocation of more than
        40% of RAM to <varname>shared_buffers</varname> will work better than a
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F4

### F2 · Imprecise · Applicable · Imprecise: “None of them when you need a filtered subset…”
Location: excerpt · section “Which to reach for” · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=None%20of%20them%20when%20you%20need%20a%20filtered%20subset)
Article says:
```text
None of them when you need a filtered subset…
```
What is true:
TABLESAMPLE chooses rows before WHERE, so it cannot guarantee a requested qualifying sample size. The article demonstrates filtering that sample. Its conclusion says none of the methods suit filtered subsets. That wording also excludes key hashing, which can accompany another WHERE predicate.
So what:
Use TABLESAMPLE with WHERE for approximate filtered results, or combine the key-hash condition with the desired predicate.
Review: We read the conclusion as a warning about sampling before filtering. The article already demonstrates a working filtered TABLESAMPLE query. The remaining defect is the conclusion's blanket wording, especially its inclusion of key hashing. We tested the reading that filtering cannot guarantee enough qualifying rows. That caution holds, but excluding key hashing and approximate filtered queries remains too broad.

Sources:
- [REL_18_6 · doc/src/sgml/ref/select.sgml:438-443](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/select.sgml#L438-L443)
  Excerpt:
  ```text
  This sampling precedes the application of any other filters such
        as <literal>WHERE</literal> clauses.
  ```
- [REL_18_6 · src/backend/access/hash/hashfunc.c:103-114](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/hash/hashfunc.c#L103-L114)
  Excerpt:
  ```text
  return hash_uint32_extended(lohalf, PG_GETARG_INT64(1));
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F2

## Verified accurate claims (5)

### F5 · Accurate · Factual · Verified accurate: “…Both built-in sampling methods hash part of that address together with a seed…”
Location: excerpt · section “Every row has an address” · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=Both%20built%2Din%20sampling%20methods%20hash,address%20together%20with%20a%20seed)
Article says:
```text
…Both built-in sampling methods hash part of that address together with a seed…
```
What is true:
SYSTEM hashes the block number and seed (E-2). BERNOULLI hashes the block number, tuple offset, and seed (E-13). Equal inputs preserve selection decisions. Heap sampling skips non-normal item pointers (E-25). These ranges verify address-based selection, without verifying HOT update placement or measured retention.
Review: We checked both hash inputs and tuple-pointer handling. They support address-based selection. These ranges do not establish HOT tuple placement or the displayed membership changes.

Sources:
- [REL_18_6 · src/backend/access/tablesample/bernoulli.c:195-220](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/tablesample/bernoulli.c#L195-L220)
  Excerpt:
  ```text
  * We compute the hash by applying hash_any to an array of 3 uint32's
	 * containing the block, offset, and seed.
  ```
- [REL_18_6 · src/backend/access/tablesample/system.c:185-208](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/tablesample/system.c#L185-L208)
  Excerpt:
  ```text
  * We compute the hash by applying hash_any to an array of 2 uint32's
	 * containing the block number and seed.
  ```
- [REL_18_6 · src/backend/access/heap/heapam_handler.c:2280-2320](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam_handler.c#L2280-L2320)
  Excerpt:
  ```text
  /* Skip invalid tuple pointers. */
			itemid = PageGetItemId(page, tupoffset);
			if (!ItemIdIsNormal(itemid))
				continue;
  ```
- [REL_18_6 · src/backend/executor/nodeSamplescan.c:248-272](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeSamplescan.c#L248-L272)
  Excerpt:
  ```text
  seed = DatumGetUInt32(DirectFunctionCall1(hashfloat8, datum));
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F5

### F6 · Accurate · Factual · Verified accurate: “…larger than a quarter of shared_buffers…”
Location: excerpt · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=larger%20than%20a%20quarter%20of%20shared_buffers)
Article says:
```text
…larger than a quarter of shared_buffers…
```
What is true:
heapam.c selects BAS_BULKREAD for eligible non-local relations exceeding NBuffers / 4 blocks. The caller must permit the strategy (E-15). shared_buffers sets shared-buffer memory (E-11). These ranges verify the threshold and eligibility conditions.
Review: We checked local-buffer exclusions, caller permission, and the strict quarter-buffer threshold. E-15 confirms BAS_BULKREAD selection. Neither cited range establishes how its ring limits cache displacement.

Sources:
- [REL_18_6 · doc/src/sgml/config.sgml:1727-1760](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L1727-L1760)
  Excerpt:
  ```text
  because <productname>PostgreSQL</productname> also relies on the
        operating system cache, it is unlikely that an allocation of more than
  ```
- [REL_18_6 · src/backend/access/heap/heapam.c:391-404](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L391-L404)
  Excerpt:
  ```text
  if (!RelationUsesLocalBuffers(scan->rs_base.rs_rd) &&
		scan->rs_nblocks > NBuffers / 4)
	{
		allow_strat = (scan->rs_base.rs_flags & SO_ALLOW_STRAT) != 0;
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F6

### F7 · Accurate · Factual · The join settings support the alternative-plan comparison
Location: excerpt · section “The join doesn't shrink” · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=SET%20enable_hashjoin%20%3D%20off%20%3B%20SET%20enable_mergejoin%20%3D%20off%20%3B)
Article says:
```text
…SET enable_hashjoin = off ; SET enable_mergejoin = off ;…
```
What is true:
enable_hashjoin and enable_mergejoin control the planner's respective join methods. Both default to on. Setting both off changes subsequent planning for the illustrated inner join. The source separately permits these methods for FULL joins when necessary.
Charitable reading:
The settings support this inner-join comparison. FULL joins can retain otherwise disabled methods when required.
Review: We checked whether disabled join methods can remain available. joinpath.c preserves FULL-join exceptions, which the finding states. The illustrated query uses an inner join. We checked whether these controls guarantee every displayed performance claim. The finding makes no such guarantee. Documentation confirms both controls, and joinpath.c confirms the stated FULL JOIN exceptions.

Sources:
- [REL_18_6 · doc/src/sgml/config.sgml:5644-5656](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L5644-L5656)
  Excerpt:
  ```text
  Enables or disables the query planner's use of hash-join plan
        types. The default is <literal>on</literal>.
  ```
- [REL_18_6 · doc/src/sgml/config.sgml:5743-5755](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L5743-L5755)
  Excerpt:
  ```text
  Enables or disables the query planner's use of merge-join plan
        types. The default is <literal>on</literal>.
  ```
- [REL_18_6 · src/backend/optimizer/path/joinpath.c:281-345](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/path/joinpath.c#L281-L345)
  Excerpt:
  ```text
  if (enable_hashjoin || jointype == JOIN_FULL)
		hash_inner_and_outer(root, joinrel, outerrel, innerrel,
  ```
- [REL_18_6 · src/backend/optimizer/path/joinpath.c:170-249](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/path/joinpath.c#L170-L249)
  Excerpt:
  ```text
  if (enable_mergejoin || jointype == JOIN_FULL)
		extra.mergeclause_list = select_mergejoin_clauses(root,
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F7

### F8 · Accurate · Factual · ANALYZE uses its own block and row sampling
Location: excerpt · section “Which to reach for” · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=ANALYZE%20builds%20pg_stats%20from%20a%20sample%20too)
Article says:
```text
ANALYZE builds pg_stats from a sample too…
```
What is true:
ANALYZE initializes BlockSampler with a random seed from pg_global_prng_state. It then samples rows within selected blocks. pg_stats exposes information stored in pg_statistic. Changing samples can change statistics without changes to table data.
Charitable reading:
ANALYZE stores statistics in pg_statistic. The sentence uses pg_stats as the user-facing name for those statistics.
Review: We checked whether pg_stats names the storage catalog and whether sampling operates only on blocks. The finding correctly identifies the view and both sampling stages. We checked the distinction between pg_stats and pg_statistic. The finding identifies pg_stats as a view. analyze.c confirms random block sampling followed by row sampling.

Sources:
- [REL_18_6 · src/backend/commands/analyze.c:1223-1233](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/analyze.c#L1223-L1233)
  Excerpt:
  ```text
  randseed = pg_prng_uint32(&pg_global_prng_state);
	nblocks = BlockSampler_Init(&bs, totalblocks, targrows, randseed);
  ```
- [REL_18_6 · src/backend/commands/analyze.c:1166-1186](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/analyze.c#L1166-L1186)
  Excerpt:
  ```text
  * Stage two scans these blocks and uses the Vitter algorithm to create
 * a random sample of targrows rows (or less, if there are less in the
 * sample of blocks).
  ```
- [REL_18_6 · doc/src/sgml/system-views.sgml:4146-4225](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/system-views.sgml#L4146-L4225)
  Excerpt:
  ```text
  The view <structname>pg_stats</structname> provides access to
   the information stored in the <link
   linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
   catalog.
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F8

### F11 · Accurate · Factual · 18,085 pages correctly round to 141 MiB
Location: excerpt · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=all%2018%2C085%20of%20them%20%28141%20MB%29)
Article says:
```text
…all 18,085 of them (141 MB)…
```
What is true:
The size conversion is correct. At 8 KiB per page, 18,085 pages occupy 141 MiB rounded (derived: 18,085 × 8,192 / 1,048,576).
Charitable reading:
PostgreSQL commonly labels binary sizes kB and MB. We used 8 KiB pages for this conversion.
Review: We recalculated 18,085 × 8,192 / 1,048,576 = 141.2890625 MiB. Rounding gives 141 MiB. The finding validates only this conversion. We recalculated 18,085 pages at 8,192 bytes per page: 141.289 MiB. Rounding gives 141 MiB. The finding states the binary-unit interpretation and does not verify the measured page count.

Sources:
- [REL_18_6 · doc/src/sgml/config.sgml:1743-1743](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L1743-L1743)
  Excerpt:
  ```text
  that is <symbol>BLCKSZ</symbol> bytes, typically 8kB.
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F11

## Notes (not graded) (2)

### F1 · Note ·  · Note: “Two independent address draws…”
Location: excerpt · section “The join doesn't shrink” · as fetched 2026-10-19 · [open in article](https://boringsql.com/posts/tablesample#:~:text=Two%20independent%20address%20draws)
Article says:
```text
Two independent address draws…
```
What is true:
Equal SYSTEM percentages and REPEATABLE seeds coordinate selection of matching block numbers across tables. These samples are correlated. This does not invalidate the displayed join count or the recommendation to hash foreign keys. The evidence establishes incorrect terminology without demonstrating an incorrect query result.
So what:
Use different REPEATABLE seeds when independent page samples are required.
Explanation: Not graded: no reader would act differently on it.
Review: Equal seeds coordinate page selection. However, these citations establish no incorrect estimator or wrong query result. The article recommends foreign-key hashing. The silent-wrong-result consequence exceeds the evidence. We tested whether different table identities separate the draws. They do not. However, these citations establish dependence, not an incorrect displayed join count or a silently wrong estimate. The recorded consequence exceeds the evidence.

Sources:
- [REL_18_6 · src/backend/access/tablesample/system.c:185-208](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/tablesample/system.c#L185-L208)
  Excerpt:
  ```text
  * We compute the hash by applying hash_any to an array of 2 uint32's
	 * containing the block number and seed.
  ```
- [REL_18_6 · src/backend/executor/nodeSamplescan.c:248-272](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeSamplescan.c#L248-L272)
  Excerpt:
  ```text
  seed = DatumGetUInt32(DirectFunctionCall1(hashfloat8, datum));
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F1

### F9 · Note ·  · A rewrite can preserve some numeric CTID values
Location: Article · exact quote · [open in article](https://boringsql.com/posts/tablesample#:~:text=every%20row%20gets%20a%20new%20address)
Article says:
```text
…every row gets a new address…
```
What is true:
rewriteheap.c assigns each tuple a block number and item offset in the destination heap. CTID contains those two values, without file identity. A tuple can receive the same numeric pair after rewriting. Rewrites do not guarantee a different CTID for every row.
Charitable reading:
A rewrite assigns tuple positions in a new heap. Calling those positions new is reasonable, but their numeric CTID values need not differ.
Explanation: Not graded: no reader would act differently on it.
Review: We tested whether a new physical file necessarily changes numeric CTIDs. CTIDs exclude file identity, and rewriteheap.c assigns destination positions. The limited note remains justified. We read new address as a position in the replacement heap. That reading is reasonable. CTID still contains only block and offset, so numeric equality remains possible. The existing note severity fits.

Sources:
- [REL_18_6 · src/backend/access/heap/rewriteheap.c:670-688](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/rewriteheap.c#L670-L688)
  Excerpt:
  ```text
  /* Update caller's t_self to the actual position where it was stored */
	ItemPointerSet(&(tup->t_self), state->rs_blockno, newoff);
  ```
- [REL_18_6 · doc/src/sgml/storage.sgml:887-908](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/storage.sgml#L887-L908)
  Excerpt:
  ```text
  item (<type>ItemPointer</type>, also known as
  <type>CTID</type>) created by
  <productname>PostgreSQL</productname> consists of a page number and the
  index of an item identifier.
  ```
- [REL_18_6 · src/backend/access/heap/rewriteheap.c:251-261](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/rewriteheap.c#L251-L261)
  Excerpt:
  ```text
  state->rs_blockno = RelationGetNumberOfBlocks(new_heap);
  ```

Finding URL: https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958#F9

## Withdrawn findings (0)

None.

## Section checks

- Introduction · B+ · 1 inaccuracy · 2 verified-accurate · 100% of claims (24 of 24, plus 14 that need data we do not have)
- Row addresses · A · 1 verified-accurate · 100% of claims (12 of 12, plus 1 that need data we do not have)
- Repeatability · A · none · 100% of claims (14 of 14, plus 14 that need data we do not have)
- Joins · B+ · 1 inaccuracy · 1 verified-accurate · 100% of claims (13 of 13, plus 20 that need data we do not have)
- Method choice · A · 1 imprecise · 1 verified-accurate · 100% of claims (5 of 5, plus 3 that need data we do not have)

## Claim coverage

- Introduction: 24 of 24 Postgres claims checked, plus 14 that need data we do not have; not counted: 3 product or opinion, 1 duplicate, 3 not a claim
- Setup: 4 of 14 Postgres claims checked, plus 3 that need data we do not have; not counted: 1 product or opinion, 1 not a claim; not checked: 10 for other reasons
- Row addresses: 12 of 12 Postgres claims checked, plus 1 that need data we do not have; not counted: 2 not a claim
- Page bundles: 7 of 9 Postgres claims checked, plus 8 that need data we do not have; not counted: 1 duplicate, 1 not a claim; not checked: 2 for other reasons
- Repeatability: 14 of 14 Postgres claims checked, plus 14 that need data we do not have; not counted: 3 not a claim
- Key hashing: 7 of 7 Postgres claims checked, plus 10 that need data we do not have; not counted: 1 product or opinion, 1 duplicate, 1 not a claim
- Joins: 13 of 13 Postgres claims checked, plus 20 that need data we do not have; not counted: 1 product or opinion, 3 duplicate, 2 not a claim
- Method choice: 5 of 5 Postgres claims checked, plus 3 that need data we do not have; not counted: 3 duplicate, 1 not a claim
- Footer: no checkable claims; not counted: 2 product or opinion, 2 not a claim

## What we did not check

- We did not reproduce the displayed timings, row counts, retention percentages, or variance measurements.
- We did not verify the original page's SQL formatting.
- We did not verify five distinct claims against primary sources.
- We did not verify the sampling implementations, parallel-plan restrictions, or ANALYZE seed controls.
- We did not reproduce the measurements or verify the PostgreSQL 18.6 runtime used for them.
- We did not establish which claims changed between publication and October 19, 2026.
- We did not reproduce the article's timings, storage sizes, sample draws, update retention counts, or 200-seed comparisons.
- We did not verify that all 50,001 customers have orders.
- Section “Setup”: we checked 4 of 17 checkable claims.
- We could not decide whether the published benchmark details are complete.
- We could not decide whether the article depends on finding F3.
- We could not decide whether the article depends on finding F4.

## Notes

- B — the findings address the article's main subject. What we did not check is listed below. The findings directly check TABLESAMPLE address selection, repeatability, join behavior, and method-choice recommendations against PostgreSQL 18.6 source.
- 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.18 · benchmark not reproducible, one step off (no hardware) · 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); https://boringsql.com/posts/explain-buffers/ (fetched 2026-10-19T07:59:53.104492Z); https://boringsql.com/posts/files-forks-and-relfilenodes/ (fetched 2026-10-19T08:00:06.997128Z); https://boringsql.com/posts/hot-updates/ (fetched 2026-10-19T08:00:00.042090Z); https://boringsql.com/posts/inside-the-8kb-page/ (fetched 2026-10-19T07:59:56.533803Z); https://boringsql.com/posts/introduction-to-buffers/ (fetched 2026-10-19T07:59:54.723500Z); https://boringsql.com/posts/vacuum-at-the-page-level/ (fetched 2026-10-19T07:59:58.346302Z); https://boringsql.com/tags/deep-dive/ (fetched 2026-10-19T08:00:03.561349Z); https://boringsql.com/tags/internals/ (fetched 2026-10-19T08:00:05.080361Z); https://boringsql.com/tags/postgresql/ (fetched 2026-10-19T08:00:01.765369Z).
- Article captured 2026-10-19T07:59:41.815466Z · SHA-256 88bf6f9250fab2db3ab1d219484d264af224c7ee0b904545101dcb20083d5be6 · Text extracted from the article's HTML.
- Policy SHA-256 be548be42f4d25f1d3be5224412da42ea7177456c3bf8867e1ebc94357a77296 · Grading rules SHA-256 6fb334e79d6b9e7ed81d3238cc10d9de602ff87ed65ff2fa781f53bac5798765.
- We did not reproduce the displayed timings, storage sizes, sample draws, retention counts, or 200-seed comparisons.
- We did not verify the original page's SQL formatting or the PostgreSQL 18.6 runtime used for the measurements.
- We did not verify that all 50,001 customers have orders.
- We did not establish which claims changed between publication and October 19, 2026.
- The site's tag listings identify Radim Marek and October 11, 2026. They provide no publication time, so we use midnight UTC.
- review: the findings were written by one model and reviewed independently by a different model.
- 2026-10-30: Regraded under the current grading rules: the letter is the average of the axis letters, with every cap stated under it.
- 5 passages in this edition fell short of our own plain-English rules.
- Built from the article text captured above, one pinned source tree, and 9 fetched pages.
- 5 survived · 5 weakened · 0 withdrawn.

## Revision history

- [Revision 1](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958?v=16) · 2026-10-12 02:44 UTC · C+ · audit version not recorded · regrade version not recorded
  Article as first submitted. 13 accurate · 2 wrong · 1 caveat.
  ElephantSeal: C+.
  Changes: First audit. Open: F2 “Sample scans can execute inside parallel workers” (false); F1 “Full scans do not necessarily read every page from physical disk” (misleading); F12 “Two independent address draws keep 288 of them…” (mostly accurate).
- [Revision 2](https://pgtrue.postgres.ai/shared/brief/25eecb81-8ef3-4705-b362-35732dd9d958?v=22) · this page · 2026-10-19 07:59 UTC · B · audited with v1.0.14 (approx.) · regraded with v1.1.3
  Same article text, re-audited. 5 accurate · 2 wrong · 1 caveat.
  ElephantSeal: B. Open: the benchmark cannot yet be rerun from what is published.
  Changes: No longer reported: “Full scans do not necessarily read every page from physical disk”; “Two independent address draws keep 288 of them…”. New: F4 “…a scan reads all of them from disk, every time…” (false); F2 “None of them when you need a filtered subset…” (mostly accurate).

Updated your article? Request a correction. A new edition appears at this address.