Re: Bitmap Indexes patch (was Re: Bitmap Indexes: request for feedback)

From: "Vladimir Sitnikov" <sitnikov(dot)vladimir(at)gmail(dot)com>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Greg Stark" <stark(at)enterprisedb(dot)com>, "Gianni Ciolli" <gianni(dot)ciolli(at)2ndquadrant(dot)it>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "Gabriele Bartolini" <gabriele(dot)bartolini(at)2ndquadrant(dot)it>
Subject: Re: Bitmap Indexes patch (was Re: Bitmap Indexes: request for feedback)
Date: 2008-11-03 23:53:28
Message-ID: 1d709ecc0811031553o66752568m36c311586cc06ad4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I looked at that aspect of the patch specifically a few weeks back while
> checking for possible issues with Hot Standby. IIRC the patch is fairly
> careful with locking and uses Exclusive locks extensively throughout. I
> looked at both the theory and the implementation. Unless Gianni changed
> something in that regard recently, I don't understand that comment at
> all. Probably need to provide specific examples of your concerns.
>
The major thing there is to get the modifications right. There is no much
sense in reviewing "wrong" code against "locking issues".

I wish to focus on the performance aspect of the patch, however, it turned
out there are major issues with functionality: the index stores wrong tids
inside :(
I really would love to fix that issue and have a chance to validate the
performance. Unfortunately, I have spent more than a day with almost void
success.

I have two testcases for which the index fails to get the correct result:

Testcase 1 (I guess there is a conflict between _bitmap_formitem and
mergewords):

Basically I create a table with all the rows equal to 1 besides 19-th, which
is 0.

create table t1 as select case when i=19 then 0 else 1 end as i from
generate_series(1,20) as s(i)
create index t1ix on t1 using bitmap (i) where i = 0;
set enable_seqscan=off;
select ctid,i From t1 where i=0; -- no rows selected. Debug shows index
suggests ctid==(0,35) instead of (0,19). 35==16+16+3.

Testcase 2

create table t2 as select i, 0 j from generate_series(1,1000) as s(i);
update t2 set j=1 where i in (5, 230)
create index t2ix on t2 using bitmap(j) where j=1;

set enable_seqscan=off;
select ctid, i, j from t2 where j=1; -- no rows selected. Debug shows index
suggests ctids==(0,97) and (0,98) instead of (4,97) and (4,98) -- it loses
page number somewhere on the way.

Both testcases reveal defects in index creation.

Regards,
Vladimir Sitnikov

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-11-04 00:07:24 Re: Enable pl/python to return records based on multiple OUT params
Previous Message Simon Riggs 2008-11-03 23:39:45 Re: Bitmap Indexes patch (was Re: Bitmap Indexes: request for feedback)