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 20200324060631.GC21443@telsasoft.com
Whole thread Raw
In response to Re: improve transparency of bitmap-only heap scans  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: improve transparency of bitmap-only heap scans  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On Tue, Mar 24, 2020 at 10:54:05AM +0530, Amit Kapila wrote:
> On Fri, Mar 20, 2020 at 7:09 AM James Coleman <jtc331@gmail.com> wrote:
> >
> > Awesome, thanks for confirming with an actual plan.
> >
> > > 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.
> >
> > I tweaked that (and a comment that didn't reference the change); see attached.
> >
> 
> Few comments:
> 1.
> -
> - if (tbmres->ntuples >= 0)
> + else if (tbmres->ntuples >= 0)
>   node->exact_pages++;
> 
> How is this change related to this patch?

Previously, a page was either "exact" or "lossy".
Now it's one of exact/lossy/skipped.
(But not exact/lossy but in either case might be skipped).

                        if (skip_fetch)
                        {
                                /* can't be lossy in the skip_fetch case */
                                Assert(tbmres->ntuples >= 0);

                                /*
                                 * The number of tuples on this page is put into
                                 * node->return_empty_tuples.
                                 */
                                node->return_empty_tuples = tbmres->ntuples;
+                               node->unfetched_pages++;
                                                              
 
                        }
                                                              
 
                        else if (!table_scan_bitmap_next_block(scan, tbmres))
                                                              
 
                        {
                                                              
 
                                /* AM doesn't think this block is valid, skip */
                                                              
 
                                continue;
                                                              
 
                        }
                                                              
 
-
                                                              
 
-                       if (tbmres->ntuples >= 0)
                                                              
 
+                       else if (tbmres->ntuples >= 0)
                                                              
 
                                node->exact_pages++;
                                                              
 
                        else
                                                              
 
                                node->lossy_pages++;
                                                              
 

-- 
Justin



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Why does [auto-]vacuum delay not report a wait event?
Next
From: Amit Kapila
Date:
Subject: Re: improve transparency of bitmap-only heap scans