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

Commitf3e4581

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 parent82c87af commitf3e4581

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

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

209209
BitmapAdjustPrefetchIterator(node,tbmres);
210210

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

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

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2964,6 +2964,7 @@ update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a;
29642964
Index Cond: (a = 1)
29652965
-> Bitmap Heap Scan on ab_a1_b3 ab_a1_b3_1 (actual rows=0 loops=1)
29662966
Recheck Cond: (a = 1)
2967+
Heap Blocks: exact=1
29672968
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1)
29682969
Index Cond: (a = 1)
29692970
-> Materialize (actual rows=1 loops=1)
@@ -2985,14 +2986,16 @@ update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a;
29852986
Index Cond: (a = 1)
29862987
-> Bitmap Heap Scan on ab_a1_b3 ab_a1_b3_1 (actual rows=0 loops=1)
29872988
Recheck Cond: (a = 1)
2989+
Heap Blocks: exact=1
29882990
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1)
29892991
Index Cond: (a = 1)
29902992
-> Materialize (actual rows=0 loops=1)
29912993
-> Bitmap Heap Scan on ab_a1_b3 (actual rows=0 loops=1)
29922994
Recheck Cond: (a = 1)
2995+
Heap Blocks: exact=1
29932996
-> Bitmap Index Scan on ab_a1_b3_a_idx (actual rows=1 loops=1)
29942997
Index Cond: (a = 1)
2995-
(65 rows)
2998+
(68 rows)
29962999

29973000
table ab;
29983001
a | b

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp