There is a bug in the in-memory bitmap index on the CVS Tip. Consider this query: select * from bt1 where g=2 and e=20, which will generate the following query plan:
QUERY PLAN ---------------------------------------------------------------------------------------- Bitmap Heap Scan on bt1 (cost=2041.47..19807.47 rows=8451 width=159) Recheck Cond: ((e = 20) AND (g = 2)) -> BitmapAnd (cost=2041.47..2041.47 rows=8451 width=0) -> Bitmap Index Scan on bt1_btree_e (cost=0.00..145.91 rows=25404 width=0) Index Cond: (e = 20) -> Bitmap Index Scan on bt1_btree_g (cost=0.00..1895.31 rows=332661 width=0) Index Cond: (g = 2) (7 rows) With default work_mem setting (1024), the bitmap generated for (e=20) will not have lossy pages, while the bitmap generated for (g=2) will have lossy pages. The problem appears when a page in the first bitmap tries to intersect with the second bitmap. The current code didn't set the page in the first bitmap to lossy after the intersection. As a result, incorrect answers are returned. A patch is attached in this email. Sincerely, Jie Zhang Greenplum
pgsql-bitmapscan-bugfix.patch
Description: pgsql-bitmapscan-bugfix.patch
---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq