Edition of Saturday 28 November 2026

Analyze on a Mostly-Null Column

Comments on “Analyze on a Mostly-Null Column”

Claim-checked. Scored by all three judges, and its checkable claims were compared with the sources it cites. How far stories are checked

Radim Marek of boringSQL shows why PostgreSQL's n_distinct for a mostly-NULL column swings between runs of ANALYZE. On a 10-million-row lab table where 0.2% of rows are non-NULL, the sample holds about 60 values. If none repeat, analyze.c declares the column unique, and about 75 of 200 runs did. That flips the join plan, and a stable fix is a higher statistics target or a manual n_distinct. The tests cover one synthetic table on PostgreSQL 18.7.

Read the original at boringsql.com. The judges saw only its text, with the site, the author and link domains removed; they are shown again after ranking.

Why it ranked

No. 4 of 77 with a score of 0.71. The panel rated it highest on technical depth (0.96) and substantiated (0.96), lowest on significance (0.51).

AI judgeJudge 2claude-haiku-5-5
Deep, reproducible PostgreSQL planner analysis of ANALYZE's n_distinct behavior with experiments and practical fixes; highly relevant to database builders, modest broader significance.
AI judgeJudge 3gpt-5.6-luna
A highly reproducible PostgreSQL engineering investigation explains unstable n_distinct estimates for sparse nullable columns, demonstrates plan flips and costs, and provides tested mitigations. It is technically deep and actionable, though mainly relevant to PostgreSQL practitioners.

Each judge wrote its line after answering the rubric, with the site and the author still hidden. Every answer behind this is in the table under Score.

Score

0.71total under rubric v2.3

Judges’ mean answer per question, on a scale from 0 to 1. Questions marked minus count against the score.
  • Significance0.51
  • Reader interest0.81
  • Audience breadth0.52
  • Practical relevance0.83
  • Substantiated0.96
  • Technical depth0.96
  • New information0.90
  • Counts against: Promotional0.03
  • Counts against: Overclaim0.12

Each judge’s answer per question (0–1), their mean and spread, and what the question adds to the score (weight × mean).

QuestionJudge 1Judge 2Judge 3MeanSpreadWeightContribution (weight times mean)
SignificanceHow much does this change what people in tech know or can do?0.510.350.670.510.32+0.24+0.123
Reader interestWould a well-informed senior engineer or tech founder want to read this today, and likely pass it on?0.720.800.900.810.18+0.26+0.210
Audience breadthHow many people who build technology does it concern?0.500.500.550.520.05+0.13+0.067
Practical relevanceHow useful is it to someone who builds software or tech products?0.780.850.880.830.10+0.22+0.184
SubstantiatedHow well is it backed? Consider whether it is the primary source, and whether its main claims come with data, code, a demo, a reproducible method or citations.0.990.920.960.960.07+0.05+0.048
Technical depthHow technically substantive is it?1.000.950.940.960.06+0.05+0.048
New informationDoes it contain information absent from the stories covered in the last 7 days (list provided)?0.830.900.980.900.15+0.05+0.045
PromotionalIs it mainly marketing with little substance (a press release, ad or sponsored post with no real information)? A launch post that carries real news is not promotional.0.030.050.010.030.04−0.19−0.006
OverclaimDo the headline or conclusions claim more than the body supports?0.140.150.080.120.07−0.11−0.014
Sum of contributions+0.705
Claim-check penalty0.000
Total, as published0.705

Spread is the highest minus the lowest judge answer. marks a spread above 0.40: the judges disagree, and the story is marked contested.

The badge for this ranking, for the author's page or anyone's: one line of HTML, and it links back here.

Ranked #4 on Rubric, 28 Nov 2026
<a href="https://rubric.hrih.si/editions/2026-11-28/4/"><img src="https://rubric.hrih.si/badge/2026-11-28/4.svg" alt="Ranked #4 on Rubric, 28 Nov 2026" width="238" height="28"></a>

Claim check

Claim check: 1 matches source · 6 no source given · 1 couldn’t check. Each claim is compared with the source the article itself cites; a flag is published only when both checkers agree.

  1. Matches sourceNumber

    With the default statistics target of 100, PostgreSQL's ANALYZE samples 30,000 rows (a multiplier of 300 set in analyze.c).

    The cited source says the same thing.

    The article says

    “With the default default_statistics_target of 100 it samples 30,000 rows (the multiplier of 300 is in analyze.c”

    The source says

    “With the default target of 100, that's 30,000 rows”

    Source cited by the article: boringsql.com/posts/postgresql-statistics

  2. No source givenCausal conclusion

    In compute_scalar_stats, if no repeated non-null values are found in the sample, PostgreSQL treats the column as unique and sets stadistinct to minus the non-NULL fraction.

    The article gives no link or citation for it.

    The article says

    “If none did, the column is declared unique, and the stored value is minus the non-NULL share of the table”

    The source says

    No source to compare with.

  3. Couldn’t checkNumber

    Over 200 ANALYZE runs on the lab table, escalated_to n_distinct ranged from -0.0025666952 to 2696 with 75 negative results, while customer_id stayed between 183672 and 206763.

    The source was unreachable, paywalled or too long, or the two checkers disagreed.

    The article says

    “escalated_to | 200 | -0.0025666952 | 2696 | 94 | 75”

    The source says

    No passage could be compared.

    Source cited by the article: boringsql.com/files/analyze-mostly-null-column/analyze-200.sql

  4. No source givenNumber

    The birthday-problem calculation predicts a repeat-free ("unique") sample in 44% of runs, versus 75 of 200 observed.

    The article gives no link or citation for it.

    The article says

    “predicts "unique" in 44% of runs. I got 75 of 200, and an earlier batch of 200 on the same data gave 96”

    The source says

    No source to compare with.

  5. No source givenCausal conclusion

    With a foreign key between the join columns, the planner ignores n_distinct and assumes each referencing row matches one referenced row, giving an estimate about 490 times too high when the column is mostly NULL.

    The article gives no link or citation for it.

    The article says

    “a nullable foreign key trades an estimate that changes between runs for one that is stable and 490 times too high”

    The source says

    No source to compare with.

  6. No source givenNumber

    In the team query, the plan picked after a sample with repeats (merge join) reads twice the buffers of the nested loop plan chosen after a repeat-free sample (11091 vs 5404).

    The article gives no link or citation for it.

    The article says

    “The better estimate picked the plan that reads twice the buffers”

    The source says

    No source to compare with.

  7. No source givenNumber

    Raising the statistics target to 1000 on escalated_to removed negative estimates over 200 runs but raised ANALYZE time on tickets from 92 ms to 624 ms.

    The article gives no link or citation for it.

    The article says

    “ANALYZE tickets went from 92 ms to 624 ms, because the sample size for the whole table follows its most demanding column”

    The source says

    No source to compare with.

  8. No source givenCausal conclusion

    Setting n_distinct = 2000 on the column makes pg_stats.n_distinct 2,000 on every run but does not freeze the plan cost, since histograms and other columns are still resampled.

    The article gives no link or citation for it.

    The article says

    “Pinning one column does not freeze the plan's cost either”

    The source says

    No source to compare with.

Also covered by

No other coverage was clustered with this story.

Elsewhere

Elsewhere: HN 1 pts, not on front page

Discussion on Hacker News

Recorded for context only, checked 28 Nov 2026, 05:47 UTC. It played no part in the ranking.

Panel for this edition

Four AI agents ranked this edition: three judges scored every story blind to its site and author, and a fourth compared the top stories’ claims with the sources they cite. Summaries are written by AI.

Model versions are pinned for every edition. How ranking works describes rubric v2.3.

Comments

Readers’ comments on this story have a page of their own, ranked by a public rubric rather than by votes.

Comments on “Analyze on a Mostly-Null Column”

More on Rubric

From the last 7 editions, chosen by shared topic, score and date.