Re: improve transparency of bitmap-only heap scans - Mailing list pgsql-hackers
From | Justin Pryzby |
---|---|
Subject | Re: improve transparency of bitmap-only heap scans |
Date | |
Msg-id | 20200320012606.GV26184@telsasoft.com Whole thread Raw |
In response to | Re: improve transparency of bitmap-only heap scans (James Coleman <jtc331@gmail.com>) |
Responses |
Re: improve transparency of bitmap-only heap scans
|
List | pgsql-hackers |
On Mon, Mar 16, 2020 at 09:08:36AM -0400, James Coleman wrote: > Does the original optimization cover parallel bitmap heap scans like this? It works for parallel bitmap only scans. template1=# explain analyze select count(*) from exp where a between 25 and 35 and d between 5 and 10; Finalize Aggregate (cost=78391.68..78391.69 rows=1 width=8) (actual time=525.972..525.972 rows=1 loops=1) -> Gather (cost=78391.47..78391.68 rows=2 width=8) (actual time=525.416..533.133 rows=3 loops=1) Workers Planned: 2 Workers Launched: 2 -> Partial Aggregate (cost=77391.47..77391.48 rows=1 width=8) (actual time=518.406..518.406 rows=1 loops=3) -> Parallel Bitmap Heap Scan on exp (cost=31825.37..77245.01 rows=58582 width=0) (actual time=296.309..508.440rows=43887 loops=3) Recheck Cond: ((a >= 25) AND (a <= 35) AND (d >= 5) AND (d <= 10)) Heap Blocks: unfetched=4701 exact=9650 -> BitmapAnd (cost=31825.37..31825.37 rows=140597 width=0) (actual time=282.590..282.590 rows=0 loops=1) -> Bitmap Index Scan on index_exp_a (cost=0.00..15616.99 rows=1166456 width=0) (actual time=147.036..147.036rows=1099872 loops=1) Index Cond: ((a >= 25) AND (a <= 35)) -> Bitmap Index Scan on index_exp_d (cost=0.00..16137.82 rows=1205339 width=0) (actual time=130.366..130.366rows=1200000 loops=1) Index Cond: ((d >= 5) AND (d <= 10)) > +++ b/src/backend/commands/explain.c > @@ -2777,6 +2777,8 @@ show_tidbitmap_info(BitmapHeapScanState *planstate, ExplainState *es) > { > if (es->format != EXPLAIN_FORMAT_TEXT) > { > + ExplainPropertyInteger("Unfetched Heap Blocks", NULL, > + planstate->unfetched_pages, es); > ExplainPropertyInteger("Exact Heap Blocks", NULL, > planstate->exact_pages, es); > ExplainPropertyInteger("Lossy Heap Blocks", NULL, > @@ -2784,10 +2786,14 @@ show_tidbitmap_info(BitmapHeapScanState *planstate, ExplainState *es) > } > else > { > - if (planstate->exact_pages > 0 || planstate->lossy_pages > 0) > + if (planstate->exact_pages > 0 || planstate->lossy_pages > 0 > + || planstate->unfetched_pages > 0) > { > ExplainIndentText(es); > appendStringInfoString(es->str, "Heap Blocks:"); > + if (planstate->unfetched_pages > 0) > + appendStringInfo(es->str, " unfetched=%ld", > + planstate->unfetched_pages); > if (planstate->exact_pages > 0) > appendStringInfo(es->str, " exact=%ld", planstate->exact_pages); > if (planstate->lossy_pages > 0) I don't think it matters in nontext mode, but at least in text mode, I think maybe the Unfetched blocks should be output after the exact and lossy blocks, in case someone is parsing it, and because bitmap-only is a relatively new feature. Its output is probably less common than exact/lossy. -- Justin
pgsql-hackers by date: