Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f4eb73

Browse files
committed
Fix EXPLAIN Bitmap heap scan to count pages with no visible tuples
Previously, bitmap heap scans only counted lossy and exact pages forexplain when there was at least one visible tuple on the page.heapam_scan_bitmap_next_block() returned true only if there was a"valid" page with tuples to be processed. However, the lossy and exactpage counters in EXPLAIN should count the number of pages representedin a lossy or non-lossy way in the constructed bitmap, regardless ofwhether or not the pages ultimately contained visible tuples.Backpatch to all supported versions.Author: Melanie PlagemanDiscussion:https://www.postgresql.org/message-id/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA@mail.gmail.comDiscussion:https://www.postgresql.org/message-id/CAAKRu_bxrXeZ2rCnY8LyeC2Ls88KpjWrQ%2BopUrXDRXdcfwFZGA@mail.gmail.com
1 parent34c854b commit1f4eb73

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ BitmapHeapNext(BitmapHeapScanState *node)
207207

208208
BitmapAdjustPrefetchIterator(node,tbmres);
209209

210+
if (tbmres->ntuples >=0)
211+
node->exact_pages++;
212+
else
213+
node->lossy_pages++;
214+
210215
/*
211216
* We can skip fetching the heap page if we don't need any fields
212217
* from the heap, and the bitmap entries don't need rechecking,
@@ -238,11 +243,6 @@ BitmapHeapNext(BitmapHeapScanState *node)
238243
continue;
239244
}
240245

241-
if (tbmres->ntuples >=0)
242-
node->exact_pages++;
243-
else
244-
node->lossy_pages++;
245-
246246
/* Adjust the prefetch target */
247247
BitmapAdjustPrefetchTarget(node);
248248
}

‎src/test/regress/expected/partition_prune.out

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2812,6 +2812,7 @@ update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a;
28122812
Index Cond: (a = 1)
28132813
-> Bitmap Heap Scan on ab_a1_b3 ab_a1_3 (actual rows=0 loops=1)
28142814
Recheck Cond: (a = 1)
2815+
Heap Blocks: exact=1
28152816
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1)
28162817
Index Cond: (a = 1)
28172818
-> Materialize (actual rows=1 loops=1)
@@ -2827,9 +2828,10 @@ update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a;
28272828
Index Cond: (a = 1)
28282829
-> Bitmap Heap Scan on ab_a1_b3 ab_3 (actual rows=0 loops=1)
28292830
Recheck Cond: (a = 1)
2831+
Heap Blocks: exact=1
28302832
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1)
28312833
Index Cond: (a = 1)
2832-
(34 rows)
2834+
(36 rows)
28332835

28342836
table ab;
28352837
a | b

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp