Re: [9.2devel] why it doesn't do index scan only?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: depesz(at)depesz(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: [9.2devel] why it doesn't do index scan only?
Date: 2011-10-08 17:53:37
Message-ID: CAFj8pRCbRT_vx8quLiAFPc4MKvMSjUGiXhqnYV8MFHBvYAN+uQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

2011/10/8 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> hubert depesz lubaczewski <depesz(at)depesz(dot)com> 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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2011-10-08 18:21:05 Re: [9.2devel] why it doesn't do index scan only?
Previous Message pasman pasmański 2011-10-08 17:20:48 Re: [9.2devel] why it doesn't do index scan only?