Re: Bitmap index scans use of filters on available columns - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bitmap index scans use of filters on available columns
Date
Msg-id 1799.1446650071@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bitmap index scans use of filters on available columns  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: Bitmap index scans use of filters on available columns
Re: Bitmap index scans use of filters on available columns
List pgsql-hackers
Simon Riggs <simon@2ndquadrant.com> writes:
> On 4 November 2015 at 15:54, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> We generate this plan
>  Index Scan using f_x_y_idx on f  (cost=0.42..26075.71 rows=209 width=37)
>    Index Cond: (x = 5)
>    Filter: (y ~~ '%abc%'::text)

> So it should be possible to do the Filter condition on the BitmapIndexScan.

You're missing my point: that is possible in an indexscan, but *not* in a
bitmap indexscan, because the index AM APIs are totally different in the
two cases.  In a bitmap scan, nothing more than a TID bitmap is ever
returned out to anyplace that could execute arbitrary expressions.

In the case at hand, the planner should have considered a plan of this
shape as well.  Presumably it concluded it was more expensive than using
the bitmap approach.  Jeff might try "set enable_bitmapscan = 0" and
compare the estimated and actual costs.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: Re: CustomScan support on readfuncs.c
Next
From: Fabien COELHO
Date:
Subject: Re: extend pgbench expressions with functions