Attached is the correct patch, sorry for the confusion. If anyone's interested in testing it you can do so without the randomarray.c file by using Pavel Stehule's solution for generating arrays:
postgres=# create table h as (select (random()*1000000)::integer as r, repeat('x',512)::text as t from generate_series(1,1000000)); SELECT postgres=# create index hri on h(r); CREATE INDEX postgres=# analyze h; ANALYZE postgres=# \timing Timing is on. postgres=# set preread_pages = 0; explain analyze select * from h where r = any (array(select (1+random()*1000000)::integer from generate_series(1,100))); postgres=# set preread_pages = 100; explain analyze select * from h where r = any (array(select (1+random()*1000000)::integer from generate_series(1,100))); postgres=# set preread_pages = 0; explain analyze select * from h where r = any (array(select (1+random()*1000000)::integer from generate_series(1,100))); postgres=# set preread_pages = 100; explain analyze select * from h where r = any (array(select (1+random()*1000000)::integer from generate_series(1,100))); postgres=# set preread_pages = 0; explain analyze select * from h where r = any (array(select (1+random()*1000000)::integer from generate_series(1,100)));
bitmap-preread-v8.diff.gz
Description: Binary data
-- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's 24x7 Postgres support!
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match