v4-0002-ANALYZE-harden-firstcount1-tracking-in-hash-mode.patch
application/octet-stream
Filename: v4-0002-ANALYZE-harden-firstcount1-tracking-in-hash-mode.patch
Type: application/octet-stream
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v4-0002
Subject: ANALYZE: harden firstcount1 tracking in hash mode
| File | + | − |
|---|---|---|
| src/backend/commands/analyze.c | 3 | 3 |
From e850690d9c7ff8382cc9bc1cbf438722870e8b8a Mon Sep 17 00:00:00 2001 From: Chengpeng Yan <chengpeng_yan@outlook.com> Date: Sat, 7 Feb 2026 19:55:40 +0800 Subject: [PATCH v4 2/2] ANALYZE: harden firstcount1 tracking in hash mode --- src/backend/commands/analyze.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index f7a5d2d46dd..3a2c6a2e155 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -2326,10 +2326,10 @@ compute_distinct_stats(VacAttrStatsP stats, } /* - * In hash mode, a promoted singleton advances the first singleton - * boundary by one slot. + * In hash mode, keep firstcount1 at the first singleton boundary. */ - if (use_hash && was_count1 && j <= firstcount1) + while (use_hash && firstcount1 < track_cnt && + track[firstcount1].count > 1) firstcount1++; /* -- 2.50.1 (Apple Git-155)