Re: Why is indexonlyscan so darned slow? - Mailing list pgsql-hackers

From Jeff Janes
Subject Re: Why is indexonlyscan so darned slow?
Date
Msg-id CAMkU=1woatEkfHguEiLF3zFYhrf2OKUGpXLV_07uQEwShoL8Jg@mail.gmail.com
Whole thread Raw
In response to Re: Why is indexonlyscan so darned slow?  (Joshua Berkus <josh@agliodbs.com>)
Responses Re: Why is indexonlyscan so darned slow?
List pgsql-hackers
On Thu, May 17, 2012 at 5:22 AM, Joshua Berkus <josh@agliodbs.com> wrote:
> Ants,
>
> Well, that's somewhat better, but again hardly the gain in performance I'd expect to see ... especially since this is
idealcircumstances for index-only scan. 
>
> bench2=# select count(*) from pgbench_accounts;
>  count
> ----------
>  20000000
> (1 row)
>
> Time: 3827.508 ms
>
> bench2=# set enable_indexonlyscan=off;
> SET
> Time: 0.241 ms
> bench2=# select count(*) from pgbench_accounts;
>  count
> ----------
>  20000000
> (1 row)
>
> Time: 16012.444 ms
>
> For some reason counting tuples in an index takes 5X as long (per tuple) as counting them in a table.  Why?
>

It looks like the IOS is taking 4x less time, not more time.

Anyway, the IOS follows the index logical structure, not the physical
structure, so if the index is not in RAM it will really be hurt by the
lack of sequential reads.

Cheers,

Jeff


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Pre-alloc ListCell's optimization
Next
From: Fujii Masao
Date:
Subject: Re: Strange issues with 9.2 pg_basebackup & replication