Hello 2011/10/8 Tom Lane <tgl@xxxxxxxxxxxxx>: > hubert depesz lubaczewski <depesz@xxxxxxxxxx> writes: >> it is selecting 20 rows out of 30 million. why is it: >> 1. not using index only scan >> 2. not using even normal index scan? > > It thinks the bitmap scan is cheaper. Whether that's true or not is not > very clear, but nobody is claiming that the costing of index-only scans > is accurate yet. > I did a few tests and bitmap scan is faster. Maybe there is a some issue. In very simple test (and very syntetic test) create table omega(a int); insert into omega select (random()*10000)::int from generate_series(1,400000); select count(*) from omega where a = 100; and index scan is faster than index only scan. There is lot of duplicates. When I used a bigger range, a speed of bitmap index, index only scan and index scan is similar - but index scan was faster everywhere. Regards Pavel Stehule > regards, tom lane > > -- > Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general