summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rowley2024-07-08 02:43:09 +0000
committerDavid Rowley2024-07-08 02:43:09 +0000
commit7340d9362a792d3cb5f38a512d8cecacc7aceb59 (patch)
tree93a46eeaba9205590e9df3c6102857d1b9f15434
parentd7db04dfdae361479e77054670ee9d806c6a6420 (diff)
Widen lossy and exact page counters for Bitmap Heap Scan
Both of these counters were using the "long" data type. On MSVC that's a 32-bit type. On modern hardware, I was able to demonstrate that we can wrap those counters with a query that only takes 15 minutes to run. This issue may manifest itself either by not showing the values of the counters because they've wrapped and are less than zero, resulting in them being filtered by the > 0 checks in show_tidbitmap_info(), or bogus numbers being displayed which are modulus 2^32 of the actual number. Widen these counters to uint64. Discussion: https://postgr.es/m/CAApHDvpS_97TU+jWPc=T83WPp7vJa1dTw3mojEtAVEZOWh9bjQ@mail.gmail.com
-rw-r--r--src/backend/commands/explain.c12
-rw-r--r--src/include/nodes/execnodes.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 1e80fd8b68..6defd26df5 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -3635,10 +3635,10 @@ show_tidbitmap_info(BitmapHeapScanState *planstate, ExplainState *es)
{
if (es->format != EXPLAIN_FORMAT_TEXT)
{
- ExplainPropertyInteger("Exact Heap Blocks", NULL,
- planstate->exact_pages, es);
- ExplainPropertyInteger("Lossy Heap Blocks", NULL,
- planstate->lossy_pages, es);
+ ExplainPropertyUInteger("Exact Heap Blocks", NULL,
+ planstate->exact_pages, es);
+ ExplainPropertyUInteger("Lossy Heap Blocks", NULL,
+ planstate->lossy_pages, es);
}
else
{
@@ -3647,9 +3647,9 @@ show_tidbitmap_info(BitmapHeapScanState *planstate, ExplainState *es)
ExplainIndentText(es);
appendStringInfoString(es->str, "Heap Blocks:");
if (planstate->exact_pages > 0)
- appendStringInfo(es->str, " exact=%ld", planstate->exact_pages);
+ appendStringInfo(es->str, " exact=" UINT64_FORMAT, planstate->exact_pages);
if (planstate->lossy_pages > 0)
- appendStringInfo(es->str, " lossy=%ld", planstate->lossy_pages);
+ appendStringInfo(es->str, " lossy=" UINT64_FORMAT, planstate->lossy_pages);
appendStringInfoChar(es->str, '\n');
}
}
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index b62c96f206..abfcd5f590 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1817,8 +1817,8 @@ typedef struct BitmapHeapScanState
TBMIterator *tbmiterator;
TBMIterateResult *tbmres;
Buffer pvmbuffer;
- long exact_pages;
- long lossy_pages;
+ uint64 exact_pages;
+ uint64 lossy_pages;
TBMIterator *prefetch_iterator;
int prefetch_pages;
int prefetch_target;