Skip site navigation (1) Skip section navigation (2)

Bitmap index - first look

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Gianni Ciolli <gianni(dot)ciolli(at)2ndquadrant(dot)it>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Bitmap index - first look
Date: 2008-11-06 15:34:10
Message-ID: 49130E72.1000803@sigaev.ru (view raw or flat)
Thread:
Lists: pgsql-hackers
http://archives.postgresql.org/message-id/20081101000154.GO27872@fune

1) Sometimes index doesn't find all matching rows:
postgres=# SELECT * FROM qq WHERE t ='asd';
  i |  t
---+-----
  2 | asd
  1 | asd
  2 | asd
(3 rows)
postgres=# SET enable_seqscan=off;
SET
postgres=# SELECT * FROM qq WHERE t ='asd';
  i |  t
---+-----
  2 | asd
(1 row)

How to reproduce:
DROP TABLE IF EXISTS qq;
CREATE TABLE qq ( i int, t text );
INSERT INTO qq VALUES (1, 'qwe');
INSERT INTO qq VALUES (2, 'asd');
CREATE INDEX qqidx ON qq USING bitmap (i,t);
INSERT INTO qq VALUES (1, 'asd');
INSERT INTO qq VALUES (2, 'asd');
SELECT * FROM qq;
SELECT * FROM qq WHERE t ='asd';
SET enable_seqscan=off;
SELECT * FROM qq WHERE t ='asd';

2) Why is pg_am.amstrategies set to 5 while index supports only equal operation?

3) Typo in bmbulkdelete:
     /* allocate stats if first time through, else re-use existing struct */
     if (result == NULL)
           result = (IndexBulkDeleteResult *)
                   palloc0(sizeof(IndexBulkDeleteResult));

     result = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));

     'result' is allocated twice.

4) Bitmap index is marked with pg_am.amcanorder = 'f', so you don't need to 
support ammarkpos/amrestrpos - see
http://archives.postgresql.org/pgsql-hackers/2008-10/msg00862.php




-- 
Teodor Sigaev                                   E-mail: teodor(at)sigaev(dot)ru
                                                    WWW: http://www.sigaev.ru/

Responses

pgsql-hackers by date

Next:From: Merlin MoncureDate: 2008-11-06 15:44:08
Subject: patch to fix client only builds
Previous:From: Tony FernandezDate: 2008-11-06 15:21:50
Subject: Upgrading Postgres versions question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group