Analysis:
========

While debugging bitmap heap scan (BitmapHeapNext function) found that first
we perform the underlying index scan and then iterate over bitmap. Now while
iterating,  we execute ExecQual only if tbmres->recheck is true. And for the
query tbmres->recheck is false.

But from the query it seems that we should execute ExecQual as we having
"bitmpaqual" on the BitmapHeap node (Not quite sure). And when I manually
did recheck = ture, query working fine and as expected.


Regards.
Rushabh
www.EnterpriseDB.com

On Wed, Nov 19, 2008 at 4:26 PM, Rushabh Lathia <[EMAIL PROTECTED]>wrote:

> Simple select give wrong result when it uses the Bitmap Heap Scan path.
>
>
> postgres=# CREATE OR REPLACE FUNCTION my_exec_im_test_func(i integer)
> RETURNS integer AS $$
>         BEGIN
>                 RETURN i + 1;
>         END;
> $$ LANGUAGE plpgsql;
> CREATE FUNCTION
>
> postgres=# set enable_seqscan=off;
> SET
> postgres=# set enable_indexscan=off;
> SET
> postgres=# select proname from pg_proc where proname like 'my_pro1';
>        proname
> ----------------------
>  my_exec_im_test_proc
> (1 row)
>
> postgres=# explain select proname from pg_proc where proname like
> 'my_pro1';
>                                          QUERY
> PLAN
>
>
> --------------------------------------------------------------------------------
> -------------
>  Bitmap Heap Scan on pg_proc  (cost=4.26..8.27 rows=1 width=64)
>    Recheck Cond: (proname ~~ 'my_pro1'::text)
>    ->  Bitmap Index Scan on pg_proc_proname_args_nsp_index
> (cost=0.00..4.26 row
> s=1 width=0)
>          Index Cond: ((proname >= 'my'::name) AND (proname < 'mz'::name))
> (4 rows)
>
>
>
>
> --
> Rushabh Lathia
>
> www.EnterpriseDB.com




-- 
Rushabh Lathia

Reply via email to